Pcornel
Observability · Log Platforms

Log Parsing and Enrichment

Cheat sheet · https://pcornel.dk/topic.php?topic=6237

Back to the Topic

Answer

Log parsing extracts fields from raw lines (JSON, logfmt, regex, grok) and enrichment adds context (Kubernetes metadata, host, environment, GeoIP) in agents or pipelines.

Remember

Parse as early as practical but keep the original message. Test parsers against real samples. Add Kubernetes metadata via the agent.

First checks

  • fluent-bit -c fluent-bit.conf --dry-run — first check for this topic
  • curl -s localhost:9090/-/ready — Prometheus ready
  • curl -s 'localhost:9090/api/v1/query?query=up' — scrape targets up/down
  • promtool check config prometheus.yml — config valid

Verify in this order

raw line → parser → fields → enrichment → indexed

Where it usually breaks

A format change in the application breaks regex parsers silently.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6237

Confirmation

Confirm action

Continue?