Hey folks, I’m trying to scrape logs from nginx using promtail and send them to Loki so I can view them in Grafana. Any tips or advice?
Hey ABC, make sure your promtail.yaml is set up correctly and that Loki endpoint is accessible.
Thanks, XYZ! I’ll double-check the promtail config. Not sure if I did it right lol.
Also, ensure that the Loki server URL is correctly specified in promtail.yaml.
Good point, GHI. I’m using http://localhost:3100/loki/api/v1/push. Does that look right?
I’ve got promtail and Loki working by specifying the correct paths in the scrape_configs. Check your path settings.
Thanks, MNO! I’m using path: /var/log/nginx/access.log and /var/log/nginx/error.log. Should I add more?
Don’t forget to restart promtail after making changes to promtail.yaml.
Oh yeah, I did that. Still not seeing logs in Grafana. Any ideas?
Make sure Loki is running and listening on port 3100 as per your config.
Loki is running fine on 3100. Maybe something else’s up.
Try querying logs in Grafana’s Explore section using the nginx job label. It might help you see the logs.