Senior
What data source would you connect in Grafana for logs?
sobes.tech AI
Answer from AI
To display logs in Grafana, the following data sources are usually used:
- Loki — a proprietary tool from Grafana Labs for collecting and searching logs. It integrates very well with Grafana, supports labels, and is resource-efficient.
- Elasticsearch — a popular engine for storing and searching logs. Often used together with Logstash and Kibana, but Grafana can also connect to Elasticsearch as a data source.
- Promtail — an agent for collecting logs, which sends them to Loki.
If the task is to visualize logs in Grafana, the optimal choice would be Loki with Promtail for log collection. This simplifies setup, reduces load, and provides convenient log search.
Example of Loki setup in Grafana:
- Install Loki and Promtail.
- In Grafana, add a data source of type Loki, specifying the Loki server URL.
- Create dashboards with log queries via LogQL.
Thus, for logs in Grafana, I recommend using Loki as the data source.