File tree Expand file tree Collapse file tree 5 files changed +45
-15
lines changed
collecting-logs-with-alloy Expand file tree Collapse file tree 5 files changed +45
-15
lines changed Original file line number Diff line number Diff line change 1+ alloy :
2+ configMap :
3+ # -- Create a new ConfigMap for the config file.
4+ create : false
5+ name : alloy-config
6+ key : config.alloy
7+ mounts :
8+ # -- Mount /var/log from the host into the container for log collection.
9+ varlog : true
Original file line number Diff line number Diff line change @@ -34,3 +34,21 @@ loki.write "docker" {
3434 url = "http://localhost:3100/loki/api/v1/push"
3535 }
3636}
37+
38+
39+
40+ /*Each target includes the following labels:
41+ __meta_docker_container_id: ID of the container.
42+ __meta_docker_container_name: Name of the container.
43+ __meta_docker_container_network_mode: Network mode of the container.
44+ __meta_docker_container_label_<labelname>: Each label from the container.
45+ __meta_docker_network_id: ID of the Docker network the container is in.
46+ __meta_docker_network_name: Name of the Docker network the container is in.
47+ __meta_docker_network_ingress: Set to true if the Docker network is an ingress network.
48+ __meta_docker_network_internal: Set to true if the Docker network is an internal network.
49+ __meta_docker_network_label_<labelname>: Each label from the network the container is in.
50+ __meta_docker_network_scope: The scope of the network the container is in.
51+ __meta_docker_network_ip: The IP of the container in the network.
52+ __meta_docker_port_private: The private port on the container.
53+ __meta_docker_port_public: The publicly exposed port from the container, if a port mapping exists.
54+ __meta_docker_port_public_ip: The public IP of the container, if a port mapping exists.*/
Original file line number Diff line number Diff line change @@ -5,11 +5,11 @@ loki.relabel "journal" {
55 source_labels = ["__journal__systemd_unit"]
66 target_label = "unit"
77 }
8- rule {
8+ /* rule {
99 source_labels = ["unit"]
1010 action = "keep"
1111 regex = "ntp.service"
12- }
12+ }*/
1313}
1414
1515loki.source.journal "journal" {
Original file line number Diff line number Diff line change @@ -51,21 +51,12 @@ data:
5151
5252 loki.process "pod_logs" {
5353 stage.match {
54- selector = "{namespace=~\"(my|your)app\"}"
55- stage.regex {
56- expression = "(?P<method>GET|PUT|DELETE|POST)"
57- }
58- stage.regex {
59- expression = "(?P<status_code_with_http_version>HTTP.{6}\\d{3})"
60- }
61- stage.regex {
62- expression = "(?P<status_code>\\d{3})"
63- source = "status_code_with_http_version"
64- }
54+ selector = "{namespace=\"myapp\"}"
55+ stage.cri {}
6556 stage.labels {
6657 values = {
67- method = "",
68- status_code = "",
58+ flags = "",
59+ stream = "",
6960 }
7061 }
7162 }
Original file line number Diff line number Diff line change 11local.file_match "local" {
22 path_targets = [{"__path__" = "/var/log/auth.log"}]
3+ sync_period = "10s"
34}
45
56loki.source.file "local" {
7+ /* targets = [
8+ {__path__ = "/tmp/foo.txt", "color" = "pink"},
9+ {__path__ = "/tmp/bar.txt", "color" = "blue"},
10+ {__path__ = "/tmp/baz.txt", "color" = "grey"},
11+ ] */
612 targets = local.file_match.local.targets
13+ tail_from_end = false
14+ /* decompression {
15+ enabled = true
16+ initial_delay = "10s"
17+ format = "gz"
18+ } */
719 forward_to = [loki.write.local.receiver]
820}
921
You can’t perform that action at this time.
0 commit comments