Hey everyone, I was wondering if anyone had ever p...
# plugins-general
s
Hey everyone, I was wondering if anyone had ever parsed meltano/dbt/airflow logs using grafana and had a regex template for me? I'm trying to gain total observability on my stack
d
this is the yaml i set up
Copy code
version: 1
disable_existing_loggers: false

formatters:
  default:
    format: "[%(asctime)s] [%(process)d|%(threadName)10s|%(name)s] [%(levelname)s] %(message)s"
  structured_plain:
    (): meltano.core.logging.console_log_formatter
    colors: False
  structured_colored:
    (): meltano.core.logging.console_log_formatter
    colors: True
  key_value:
    (): meltano.core.logging.key_value_formatter
    sort_keys: False
  json:
    (): meltano.core.logging.json_formatter

handlers:
  console:
    class: logging.StreamHandler
    level: INFO
    formatter: structured_plain
    stream: "<ext://sys.stderr>"

root:
  level: INFO
  propagate: yes
  handlers: [console]
s
Thanks! I'm a noob in log parsing and grafana; where would I apply this?
f
If you're using Loki from the grafana folks - you could probably just configure meltano to log in json format and get pretty far using their json parser (https://grafana.com/blog/2020/10/28/loki-2.0-released-transform-logs-as-youre-querying-them-and-set-up-alerts-within-loki/#parse)
just realized thats a possibly pretty ancient blog post (sorry, would mostly still apply though I'd hope)
s
@florian.hines do you know how to configure the log output?
f
The yaml that @devon_seitz shared is actually a sample meltano logging.yaml that lets you control logging. Theres some more details at https://docs.meltano.com/reference/settings#how-to-use-10
It some what depends on how your shipping log data to Loki (not sure if you're tailing a log file or the like). But you'll either need to switch the output format to json for the log file, or the console handler (if capturing console output).
s
Awesome, thank you so much!
f
👍 if you steal the example from the meltano docs. The "formatter" option in the "handlers" section is the important bit.