40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
sources:
|
|
{{- range $value := . }}
|
|
|
|
source_{{ $value.Key }}:
|
|
type: file
|
|
include: ["{{ $value.LogDir }}"]
|
|
line_delimiter: "\n"
|
|
read_from: beginning
|
|
# Handle multi-line Java stacktraces
|
|
multiline:
|
|
start_pattern: "^[^\\s]"
|
|
mode: continue_through
|
|
condition_pattern: "(^([\\s]+at\\s|Caused by:\\s)|common frames omitted$)"
|
|
timeout_ms: 1000
|
|
ignore_older_secs: 1800
|
|
oldest_first: true
|
|
|
|
{{- end }}
|
|
|
|
transforms:
|
|
{{- range $value := . }}
|
|
|
|
transform_{{ $value.Key }}:
|
|
type: remap
|
|
inputs: ["source_{{ $value.Key }}"]
|
|
source: |
|
|
# Store Nomad metadata.
|
|
.nomad.namespace = "{{ $value.Namespace }}"
|
|
.nomad.node_name = "{{ $value.Node }}"
|
|
.nomad.job_name = "{{ $value.Job }}"
|
|
.nomad.group_name = "{{ $value.Group }}"
|
|
.nomad.task_name = "{{ $value.Task }}"
|
|
.nomad.alloc_id = "{{ $value.ID }}"
|
|
.nomad.alloc_name = "{{ $value.Name }}"
|
|
.nomad.alloc = replace("{{ $value.Name }}", r'.+\[(?P<index>\d+)\]', "$$index")
|
|
# Set instance = <TaskName>-<Alloc Index> so it's similar to what prometheus has
|
|
.nomad.instance = join!(["{{ $value.Task }}", replace("{{ $value.Name }}", r'.+\[(?P<index>\d+)\]', "$$index")], separator: "-")
|
|
|
|
{{- end }}
|