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" {
34
34
url = "http://localhost:3100/loki/api/v1/push"
35
35
}
36
36
}
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" {
5
5
source_labels = ["__journal__systemd_unit"]
6
6
target_label = "unit"
7
7
}
8
- rule {
8
+ /* rule {
9
9
source_labels = ["unit"]
10
10
action = "keep"
11
11
regex = "ntp.service"
12
- }
12
+ }*/
13
13
}
14
14
15
15
loki.source.journal "journal" {
Original file line number Diff line number Diff line change @@ -51,21 +51,12 @@ data:
51
51
52
52
loki.process "pod_logs" {
53
53
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 {}
65
56
stage.labels {
66
57
values = {
67
- method = "",
68
- status_code = "",
58
+ flags = "",
59
+ stream = "",
69
60
}
70
61
}
71
62
}
Original file line number Diff line number Diff line change 1
1
local.file_match "local" {
2
2
path_targets = [{"__path__" = "/var/log/auth.log"}]
3
+ sync_period = "10s"
3
4
}
4
5
5
6
loki.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
+ ] */
6
12
targets = local.file_match.local.targets
13
+ tail_from_end = false
14
+ /* decompression {
15
+ enabled = true
16
+ initial_delay = "10s"
17
+ format = "gz"
18
+ } */
7
19
forward_to = [loki.write.local.receiver]
8
20
}
9
21
You can’t perform that action at this time.
0 commit comments