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

58 lines
1.2 KiB
TOML

data_dir = "/var/lib/vector/"
[sources.digdag]
type = "file"
include = [ "/var/log/digdag.log" ]
ignore_older_secs = 600
read_from = "beginning"
[transforms.digdag_transform]
type = "remap"
inputs = ["digdag"]
source = '''
. |= parse_syslog!(.message)
.message = replace(.message, r'^\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2} \+\d{4} ', "")
if starts_with(.message, "[") {
l = parse_regex!(.message, r'\[(?P<level>[^\]]+)\]')
. = merge(., l)
.level = downcase(.level)
} else {
.level = "debug"
}
'''
[sinks.digdag_output]
type = "file"
inputs = [ "digdag_transform" ]
compression = "none"
path = "/tmp/digdag-%Y-%m-%d.log"
[sinks.digdag_output.encoding]
codec = "json"
[sinks.digdag_output.buffer]
max_size = 268435488
type = "disk"
[sinks.digdag_loki]
type = "loki"
inputs = [ "digdag_transform" ]
endpoint = "http://loki.service.consul:3100"
compression = "snappy"
[sinks.digdag_loki.labels]
level = "{{ level }}"
hostname = "{{ hostname }}"
job = "digdag"
filename = "/var/log/digdag.log"
[sinks.digdag_loki.encoding]
codec = "json"
[sinks.digdag_loki.buffer]
max_size = 268435488
type = "disk"