aboutsummaryrefslogtreecommitdiff
path: root/ansible/plays/templates/otelcol-contrib/config.yaml
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-12-23 17:35:29 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-12-23 17:35:29 +0100
commite768b1675922e746f09828920b05d836a1cd365b (patch)
tree505560f6c972b802e94a4bff1ec2e3e641a37fda /ansible/plays/templates/otelcol-contrib/config.yaml
parent979ec08d3d35118f106559dc59c1961cd3534ba7 (diff)
downloadinfra-e768b1675922e746f09828920b05d836a1cd365b.tar.gz
infra-e768b1675922e746f09828920b05d836a1cd365b.tar.bz2
infra-e768b1675922e746f09828920b05d836a1cd365b.tar.xz
infra-e768b1675922e746f09828920b05d836a1cd365b.zip
otelcolHEADmaster
Diffstat (limited to 'ansible/plays/templates/otelcol-contrib/config.yaml')
-rw-r--r--ansible/plays/templates/otelcol-contrib/config.yaml65
1 files changed, 65 insertions, 0 deletions
diff --git a/ansible/plays/templates/otelcol-contrib/config.yaml b/ansible/plays/templates/otelcol-contrib/config.yaml
new file mode 100644
index 0000000..671dbaa
--- /dev/null
+++ b/ansible/plays/templates/otelcol-contrib/config.yaml
@@ -0,0 +1,65 @@
+receivers:
+ journald:
+ priority: debug
+
+exporters:
+ debug:
+ verbosity: detailed
+
+ nop:
+
+ otlphttp/hash:
+ endpoint: https://loki.trygvis.io/otlp
+
+extensions:
+ file_storage/journald:
+
+processors:
+ batch: {}
+
+ transform/severity_parse:
+ log_statements:
+ - context: log
+ statements:
+ - set(resource.attributes["service.namespace"], "systemd")
+ - set(resource.attributes["service.name"], body["_SYSTEMD_UNIT"])
+ - set(resource.attributes["systemd_unit"], body["_SYSTEMD_UNIT"])
+ - set(resource.attributes["systemd_slice"], body["_SYSTEMD_SLICE"])
+ - set(resource.attributes["node"], body["_HOSTNAME"])
+
+ - set(severity_number, SEVERITY_NUMBER_TRACE) where body["PRIORITY"] == "7"
+ - set(severity_text, "debug") where body["PRIORITY"] == "7"
+ - set(severity_number, SEVERITY_NUMBER_DEBUG) where body["PRIORITY"] == "6"
+ - set(severity_text, "info") where body["PRIORITY"] == "6"
+ - set(severity_number, SEVERITY_NUMBER_INFO) where body["PRIORITY"] == "5"
+ - set(severity_text, "notice") where body["PRIORITY"] == "5"
+ - set(severity_number, SEVERITY_NUMBER_WARN) where body["PRIORITY"] == "4"
+ - set(severity_text, "warning") where body["PRIORITY"] == "4"
+ - set(severity_number, SEVERITY_NUMBER_ERROR) where body["PRIORITY"] == "3"
+ - set(severity_text, "err") where body["PRIORITY"] == "3"
+ - set(severity_number, SEVERITY_NUMBER_FATAL) where body["PRIORITY"] == "2"
+ - set(severity_text, "crit") where body["PRIORITY"] == "2"
+ - set(severity_number, SEVERITY_NUMBER_FATAL) where body["PRIORITY"] == "1"
+ - set(severity_text, "alert") where body["PRIORITY"] == "1"
+ - set(severity_number, SEVERITY_NUMBER_FATAL) where body["PRIORITY"] == "0"
+ - set(severity_text, "emerg") where body["PRIORITY"] == "0"
+
+ - set(body, body["MESSAGE"])
+
+service:
+# telemetry:
+# logs:
+# level: debug
+ extensions:
+ - file_storage/journald
+ pipelines:
+ logs:
+ receivers:
+ - journald
+ processors:
+ - transform/severity_parse
+ - batch
+ exporters:
+# - debug
+# - nop
+ - otlphttp/hash