itamae/cookbooks/nomad/files/etc/vector/nomad.toml

54 lines
1.1 KiB
TOML
Raw Normal View History

2024-04-03 09:11:41 +00:00
data_dir = "/var/lib/vector/"
[sources.nomad]
type = "file"
include = [ "/var/log/nomad.log" ]
ignore_older_secs = 600
read_from = "beginning"
[transforms.nomad_transform]
type = "remap"
inputs = ["nomad"]
source = '''
. |= parse_syslog!(.message)
lv, err = parse_regex(.message, r'(?P<timestamp>\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{4}) \[(?P<level>[^\]]+)\] +(?P<message>.*)$')
. = merge(., lv)
del(.host)
.level = downcase!(.level)
'''
[sinks.nomad_output]
type = "file"
inputs = [ "nomad_transform"]
compression = "none"
path = "/tmp/nomad-%Y-%m-%d.log"
[sinks.nomad_output.encoding]
codec = "json"
[sinks.nomad_output.buffer]
max_size = 268435488
type = "disk"
[sinks.nomad_loki]
type = "loki"
inputs = [ "nomad_transform" ]
endpoint = "http://loki.service.consul:3100"
compression = "snappy"
[sinks.nomad_loki.labels]
level = "{{ level }}"
hostname = "{{ hostname }}"
job = "nomad"
filename = "{{ file }}"
[sinks.nomad_loki.encoding]
codec = "json"
[sinks.nomad_loki.buffer]
max_size = 268435488
type = "disk"