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 {{- 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 }}" # Set alloc = - so it's similar to what prometheus has .nomad.alloc = join!(["{{ $value.Task }}", replace("{{ $value.Name }}", r'.+\[(?P\d+)\]', "$$index")], separator: "-") {{- end }}