Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export logs to grafana #42

Merged
merged 6 commits into from
Aug 5, 2023
Merged

Export logs to grafana #42

merged 6 commits into from
Aug 5, 2023

Conversation

rgrandl
Copy link
Collaborator

@rgrandl rgrandl commented Aug 3, 2023

grafana_logs_new.webm

Exporting logs to grafana is not trivial. In order to do that we need a datasource that exports logs. Grafana relies on Grafana Loki [1] to do that. Loki is a system that aggregates, index, stores and serves logs.

However, to retrieve the logs, Loki relies on Grafana Promtail [2] that is an agent that runs on each node.

This PR:

  • created a Promtail daemonset that scrapes the pod logs. In a future PR, we might want to scrape other system info, container logs, etc.
  • created a Loki service that aggregates and stores the logs from the Promtail daemonsets. However, the Loki service runs in a single pod, and stores the logs in the local filesystem. In a future PR we might need to tune the storage so we can store more logs, and/or scale up the Loki service.
  • added a Loki datasource to grafana

After this PR, Grafana should be the ultimate place to inspect logs, metrics, and traces.

Exporting logs to grafana is not trivial. In order to do that we need a
datasource that exports logs. Grafana relies on Grafana Loki [1] to do
that. Loki is a system that aggregates, index, stores and serves logs.

However, to retrieve the logs, Loki relies on Grafana Promtail [2] that
is an agent that runs on each node.

This PR:
* created a Promtail daemonset that scrapes the pod logs. In a future
  PR, we might want to scrape other system info, container logs, etc.
* created a Loki service that aggregates and stores the logs from the
  Promtail daemonsets. However, the Loki service runs in a single pod,
  and stores the logs in the local filesystem. In a future PR we might
  need to tune the storage so we can store more logs, and/or scale up
  the Loki service.
* added a Loki datasource to grafana

After this PR, Grafana should be the ultimate place to inspect logs,
metrics, and traces.
In a future PR, we should provide the namespace as a config param,
so users can run their app with kube in any namespace.
Copy link
Contributor

@spetrovic77 spetrovic77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

internal/impl/dashboard.go Outdated Show resolved Hide resolved
internal/impl/dashboard.go Outdated Show resolved Hide resolved
internal/impl/dashboard.go Outdated Show resolved Hide resolved
internal/impl/kube.go Outdated Show resolved Hide resolved
internal/impl/kube.go Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@rgrandl rgrandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Srdjan

internal/impl/kube.go Outdated Show resolved Hide resolved
internal/impl/dashboard.go Outdated Show resolved Hide resolved
@rgrandl rgrandl merged commit 3a6f8f1 into main Aug 5, 2023
8 checks passed
@rgrandl rgrandl deleted the export_logs_to_grafana branch August 5, 2023 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants