Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
...
[transforms.extract_json]
inputs = ["service_json"]
type = "json_parser"
field = "message"
target_field = "evdata"
[transforms.log_to_metric]
inputs = ["extract_json"]
type = "log_to_metric"
[[transforms.log_to_metric.metrics]]
type = "counter"
field = "evdata.level"
name = "log_levels"
tags.level = "{{evdata.level}}"
[sinks.out]
type = "loki"
inputs = ["extract_json", "access_parser", "everything_else"]
endpoint = "http://distributor.loki.svc.cluster.local:3100"
healthcheck = true
encoding.codec = "json"
batch.timeout_secs = 5
batch.max_events = 1000
buffer.max_size = 104900000
buffer.type = "memory"
[sinks.out.labels]
k8s_pod_name = "{{ kubernetes.pod_name }}"
log_filename = "{{ file }}"
k8s_app = "{{ kubernetes.pod_labels.app.kubernetes.io/name }}"
[sinks.prometheus]
type = "prometheus"
inputs = ["log_to_metric"] # required
address = "0.0.0.0:9091" # required
namespace = "vector" # required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.