Last week I introduced you to my latest project: a syslog-ng container based on Alma Linux. This week I added a syslog-ng Prometheus exporter to the container, so you can also monitor syslog-ng, if you enable it.
Before you begin
The syslog-ng Prometheus exporter is a few lines of Python script, so it does not increase the size of the container in a noticeable way. All its dependencies are already included in the container. If you downloaded the container image earlier, you should download it again.
Enabling the Prometheus exporter
As not everyone is using Prometheus, the syslog-ng Prometheus exporter is not started automatically together with syslog-ng, so you have to enable and start it yourself. Note that you must also add “-p 9577:9577” to the command line to make the syslog-ng Prometheus exporter reachable over the network. In the commands below, I named the container “sng” to make it easier to work with. The first command starts the container, while the other two enable and start the syslog-ng Prometheus exporter.
docker run -d --name=sng -v /data/log/:/var/log:Z -p 514:514 -p 9577:9577 czanik/syslog-ng:alma9_481 docker exec -ti sng systemctl enable sngexporter docker exec -ti sng systemctl start sngexporter
From now on, the syslog-ng Prometheus exporter will start automatically within the container.
What is next?
Read the syslog-ng Prometheus exporter README on how to configure it: https://github.com/czanik/sngexporter/ In an ideal case, you do not have to change anything, just use it as is from Prometheus.
-
If you have questions or comments related to syslog-ng, do not hesitate to contact us. You can reach us by email or even chat with us. For a list of possibilities, check our GitHub page under the “Community” section at https://github.com/syslog-ng/syslog-ng. On Twitter, I am available as @PCzanik, on Mastodon as @Pczanik@fosstodon.org.