Skip to content

Instantly share code, notes, and snippets.

@rrichardson
Created July 29, 2020 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrichardson/19a06835064306b4f883694622785820 to your computer and use it in GitHub Desktop.
Save rrichardson/19a06835064306b4f883694622785820 to your computer and use it in GitHub Desktop.
...
[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