Documentation : https://sbcode.net/grafana/nginx-prom...
Course Coupons : https://sbcode.net/coupons
This video is a continuation of my other videos where Loki and Promtail have already been set up and working on several hosts.
We will add to our Promtail scrape configs, the ability to read the Nginx access and error logs.
We need to add a new job_name to our existing Promtail config_promtail.yml
Restart the Promtail service and check its status.
If we look into the existing systemd-journal job that we already set up in the previous lessons, we will start to see some new errors concerning Promtail.
The promtail user, used by the Promtail service doesn't have the permissions to read the Nginx logs.
I will add the the promtail user to the user group adm so that it can read the log file.
If I go back into Grafana, I will see the new nginx job inside the Explore panel.
This is pretty good now, but we can make it better.
I want to be able to filter by the status code and other http properties.
We can do a regex in the log files as Promtail scans them and add labels to the matches.
For this we use pipeline_stages
Now I can create a dashboard for Nginx status codes.
0:00 Introducing reading Nginx log files with Promtail
0:40 Edit config-promtail.yml
1:10 Add Nginx scrape config
2:05 Additional label for host
3:30 Restart Promtail
3:50 Analyse Promtail permission errors
4:20 Edit Promtail user permissions and restart
5:10 Open Grafana and see new labels from Nginx
6:00 Discuss pipeline stages with regex
8:20 View new log labels from pipeline stages in Grafana
9:10 Analyse regex using regex101 website
11:00 Create a simple dashboard using the new Nginx log information
#grafana
#grafanaCourse
#grafanaTutorial