Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

nodiscc/netdata-logcount

Repository files navigation

netdata-logcount

Warning

netdata is now proprietary software, this plugin will no longer be maintained. it is recommended to migrate to another monitoring stack based on victoriametrics or prometheus, and grafana for visualization. See https://github.com/nodiscc/toolbox/tree/master/ARCHIVE/ANSIBLE-COLLECTION/roles/netdata for more information. This repository will be archived.

Check/graph the number of syslog messages, by level over time.

This is a python.d plugin for netdata. It parses output from lnav.

Maximum acceptable number of error/warning/info log messages over the configured time period can be configured, alarms will be raised if log message counts exceed this level.

Installation

This plugin expects the CSV output of a lnav script at /var/cache/logcount

# install lnav
apt install lnav
# clone the repository
git clone https://gitlab.com/nodiscc/netdata-logcount

# edit configuration values in these files, notably the periodicity of logcount file generation,
# update interval for the chart and alarms, and warning/critical thresholds for number of log messages
nano netdata-logcount/health.d_logcount.conf
nano netdata-logcount/cron.d_logcount
nano netdata-logcount/logcount.sql

# copy files in place
sudo mkdir /opt/netdata-logcount
netdata_install_prefix="/opt/netdata" # if netdata is installed from binary/.run script
netdata_install_prefix="" # if netdata is installed from OS packages
sudo cp netdata-logcount/logcount.sql /opt/netdata-logcount/logcount.sql
sudo cp netdata-logcount/cron.d_logcount /etc/cron.d/logcount
sudo cp netdata-logcount/logcount.chart.py $netdata_install_prefix/usr/libexec/netdata/python.d/
sudo cp netdata-logcount/python.d_logcount.conf $netdata_install_prefix/etc/netdata/python.d/logcount.conf
sudo cp netdata-logcount/health.d_logcount.conf $netdata_install_prefix/etc/netdata/health.d/logcount.conf

# generate the initial lgocount file
sudo lnav -n -f /opt/netdata-logcount/logcount.sql > /var/cache/logcount
sudo chgrp netdata /var/cache/logcount
sudo chmod g+r /var/cache/logcount

# restart netdata
systemctl restart netdata

You can also install this module using the nodiscc.xsrv.monitoring ansible role.

Configuration

Browse logs by running sudo lnav from a terminal, and read the documentation

Debug

To debug this plugin:

$ sudo su -s /bin/bash netdata
$ $netdata_install_prefix/usr/libexec/netdata/plugins.d/python.d.plugin 1  debug trace logcount

Due to the way the plugins works (parse lnav output generated each X minutes, for messages over last X minutes), message counts shown in the graph represent counts over the previous period.

License

GNU GPLv3

Mirrors

About

[mirror] Count log messages by level over time - netdata plugin

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages