by Dachande663 · 3y ago · 0 comments
I settled on a happy/ok midpoint recently whereby I dump logs in a redis queue using filebeat as it’s very simple. Then have a really simple queue consumer that dumps the logs into clickhouse using a schema Uber detailed (split keys and values), so queries can be pretty quick even over arbitrary fields. 30,00 logs an hour and I can normally search for anything in under a second.
Do you use any particular UI/Frontend tool for querying these logs?
I've also considered Grafana, but it's not good for viewing raw logs.
I think LogQL + Grafana UI is a pretty rich/interactive experience of viewing logs v/s Metabase.
https://www.metabase.com/glossary/images/table/example-table...
than this brain crushing string spaghetti view any day.
https://grafana.com/static/img/docs/v64/logs-panel.png
I can easily colorize lines depending on log severity, filter by dates with a drop-down date selector UI, filter by each column value etc all in eye friendly manner.
It’s probably incredibly boring to describe, but I think that’s why it just tends to work. The whole thing took an afternoon to write (in PHP of all things too).
The gist of it is:
- Structured logs (json) are stored as kv pairs in parallel arrays, along side metadata (host, timestamp, id, geo, namespace, etc).
- Log fields (ie kv pairs) are materialized (indexed) depending on query patterns, and vaccummed up if unused.
- Authoring queries and Kibana dashboard support is not trivial but handled with a query translation layer.
Do you mean something like two arrays [k1, ..., kN] and [v1, ..., vN] in two different columns?
Is there a way in Clickhouse to filter such a pair of arrays such that you can do a search akin to vals[indexOfKey("foo")] == "bar"?