Send journald logs to loki. Not sure if working yet.

This commit is contained in:
2023-08-08 15:08:21 +01:00
parent 8528a8fec7
commit f36109a0f8

View File

@@ -15,11 +15,14 @@ job "vector" {
task "vector" { task "vector" {
driver = "docker" driver = "docker"
config { config {
image = "timberio/vector:0.28.X-alpine" # debian instead of alpine to get journalctl
image = "timberio/vector:0.31.X-debian"
ports = ["api"] ports = ["api"]
volumes = [ volumes = [
"/var/run/docker.sock:/var/run/docker.sock:ro", "/var/run/docker.sock:/var/run/docker.sock:ro",
"/var/log/glusterfs:/var/log/glusterfs:ro", "/var/log/glusterfs:/var/log/glusterfs:ro",
"/var/log/journal:/var/log/journal:ro",
"/etc/machine-id:/etc/machine-id:ro",
] ]
} }
@@ -84,6 +87,9 @@ if length(result) > 0 {
include = [ "/var/log/glusterfs/**/*.log" ] include = [ "/var/log/glusterfs/**/*.log" ]
host_key = "node" host_key = "node"
[sources.journald_raw]
type = "journald"
[transforms.nomadify_hostname] [transforms.nomadify_hostname]
type = "remap" type = "remap"
inputs = [ inputs = [
@@ -98,7 +104,8 @@ if length(result) > 0 {
type = "loki" type = "loki"
inputs = [ inputs = [
"docker_transformed", "docker_transformed",
"nomadify_hostname" "nomadify_hostname",
"journald_raw",
] ]
endpoint = "http://[[ range service "loki" ]][[ .Address ]]:[[ .Port ]][[ end ]]" endpoint = "http://[[ range service "loki" ]][[ .Address ]]:[[ .Port ]][[ end ]]"
encoding.codec = "json" encoding.codec = "json"