-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Loki and alerts #340
Comments
Hi @soum1234! We don't have a good answer for this yet, but it is something we plan on supporting. The current idea is we're going to first add a Prometheus-style query language for Loki, then use Prometheus-style rules and alerts on top of this. |
Thanks a lot for the response |
could we expect it in the next release?also could you let me know if there are some documents on querying in boltdb pls send the link |
Prometheus style alerting for logs sounds truly amazing. Hopefully, this feature will be added soon. |
Has there been any work done on this? Any idea on when we can expect to be able to generate alerts in Grafana from Loki? |
I will start investigating this since LogQL has moved forward. |
yeah that would be nice to be able to send alerts if a specific query return results. |
By the way, have you made any progress @cyriltovena ? |
Not yet merged, but you can use promtail to create those alerts in the meantime. You can create metrics in promtail based on log retrieved from files, then scrape those promtail using a prometheus and create an alert. (https://github.com/grafana/loki/blob/master/docs/logentry/processing-log-lines.md) |
This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
How about if we're not using promtail? We're streaming logs directly into the Loki endpoint. |
We have plan to support Prometheus alert style. |
Hi @cyriltovena can you please tell me when do you plan to release Loki alerting feature? |
Loki already accepts PromQL like expressions (LogQL) on a Prometheus-compatible API, so the rough plan is to use the Cortex Ruler to evaluate Prometheus-style alert rules against logs. The Cortex Rules already exists, is horizontally scalable & highly available, so the integration should be relatively straight forward we hope. This plan is in its super early stages mind you; input is more than welcome! |
Link is dead :( |
https://github.com/grafana/loki/tree/master/docs/clients/promtail/stages You are looking for the stages section. With that, you can define metrics based on matches against the log lines. Then you use Prometheus & Alertmanager as you normally would to create the alert itself ;) I reckon this issue can be closed. |
@migueleliasweb thanks a lot, ill do that but i guess the issue should not be closed to provide built-in solution to this. |
Hey @bukowa, I'm glad I helped 😉 . Regarding the built-in solution for alerting, I would be surprised if this will ever be a feature. The integration with Prometheus/Alertmanager is already there and in every release it gets improved. Replicating the funcionality of creating and managing alerts would be highly deprioritized or even unwanted in this context. But that's just my view. |
@migueleliasweb My use case is loki for docker logs: services:
loki:
image: grafana/loki:latest
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
promtail:
image: grafana/promtail:latest
volumes:
- /var/log:/var/log
command: -config.file=/etc/promtail/docker-config.yaml
depends_on:
- loki
- grafana
grafana:
image: grafana/grafana:master
ports:
- "3000:3000"
web:
image: nginx:alpine
ports:
- 85:80
logging:
driver: loki
options:
loki-url: "http://localhost:3100/loki/api/v1/push"
loki-external-labels: "container_name={{.Name}}.{{.ID}}"
loki-batch-size: "5000"
depends_on:
- grafana
- loki
- promtail
labels:
test: 1 Everything works great (great project thank you!) but now i cannot setup alerts for these logs (i really love simple solutions). So here goes my idea that this could and should be supported. |
Really interested in |
This is great idea we want to implement. |
Hello,
|
any progress on this at all? Setting up alerts via Grafana based on a loki query. |
@tomwilkie - is there a rough ETA? maybe mention this in GrafanaCONline |
We will talk about it during the Loki future talk at GrafanaCon. ETA beta around June. |
@cyriltovena and others: I was wondering if it will come soon somehting more minimalistic like prometheus alert-manager.yaml file and alerts. Good work so far thx for feedback |
Yes @owen-d is working on alert manager style alerts. see here for more details https://youtu.be/TcmvmqbrDKU?t=1771 |
thx ! |
Simple question here, why use Alert manager when Grafana can already trigger alerts ? What's the benefits of using directly the alert manager of prometheus ? Does it offer more features ? Does grafana actually use AlertManager behind the same and that's why we must use a Prometheus Datasource ? Using Grafana to alert on logs is not very user friendly at the time (Workaround of using Loki as Prometheus data source etc..) but I already have all my metrics alerts setup in Grafana, with webhooks to slack and pager duty and I obviously prefer to keep all the alert in the same tool. Thanks ! |
Yes alert with grafana will evolve and improve. The grafana team have plan for it. But we still want alertmanager for people who are used to this experience, which has definitively more features such as routing, grouping, silencing and high availability (deduping). See https://prometheus.io/docs/alerting/latest/alertmanager/ So there’s definitely two type of users and we want both to have a stellar experience. Stay tuned. |
Hi, |
We've been running a horizontally scalable version in a dev environment successfully for a week. It's based off the #2275. Since then, there's been some discussion regarding which parts to include in Loki vs Cortex (our upstream dependency). I'm currently refactoring the approach, but the internal logic should stay similar to the approach detailed in that PR. Suffice it to say this should be coming soon :) |
Hi all. I'm currently handling this by using Grafana built-in alert with Loki added as Prometheus (PromLoki). The alert itself is getting triggered well. I'm able to get it through the Slack. But I also want to set the notification contains the actual log lines which have been queried. For now, It just displays the name of the Kubernetes container (in my case) and the hit number. Is there a way to make this possible? Thanks. |
Well, I could establish PromLoki access but when I tried to setup Alert and tested the rule I got error message (below). The query that triggered this alert also provided below. I can see graphic representation, but it seems alarm query can not get over provided query. Any idea why? |
P.S regarding case above . Original query seems Ok at least from inspector point. Can not figure out why alert display error by suing this query |
@owen-d What do you think we could do there ? Adding some more metadata to the alert ? I like the use case but that's not easy to do. |
Update Loki to 1.5. |
Greetings, |
Only possible with Grafana Alert for now. |
@cyriltovena I guess this issue is a duplicate of this #1753 or the other way around but both concern same topic. |
Closing, please see https://grafana.com/docs/loki/latest/alerting/ for docs! |
Hi, I am using loki image of version grafana/loki:2.1.0.. |
latest version of grafana support loki alert |
[release-5.9] Backport PR grafana#13708
Suppose I have to alert when there is an error log.let me know how to so it
The text was updated successfully, but these errors were encountered: