Interview Prep/Monitoring & Observability/Logging: ELK/EFK, Loki & Log Shippers

Write basic LogQL queries.

BeginnerConceptLogging: ELK/EFK, Loki & Log Shippers
Answer
{namespace="payments", app="api"}                        # stream selector
{app="api"} |= "error" != "timeout"                       # line filters
{app="api"} |~ "status=(500|502|503)"                     # regex filter
{app="api"} | json | level="error" | duration > 500ms     # parse and filter
{app="nginx"} | logfmt | line_format "{{.method}} {{.path}} {{.status}}"

Always start with the most selective stream selector, then line filters, then parsers. Line filters are the cheapest step.

All Monitoring & Observability questions Roadmap: Logging & tracing

More on Logging: ELK/EFK, Loki & Log Shippers