Log2Ram and frontail
Charly's Column – Log2Ram and frontail
If you run 25 Raspberry Pis at home, and an equal number of other IP devices, you might also think like Charly does when it comes to log management. The result is atomic technology and a logfile disk that is not permanently overloaded.
From time to time, I use nmap -sP 10.0.0.1-254
to check how many IP devices are online in my home network. There are now more than 50, half of them Raspberry Pis. The need for a central syslog server is slowly growing. An old miniature PC with an Intel Atom, which I retrofitted with an SSD, is the designated candidate for this permanent task. The syslog server comes courtesy of the standard rsyslogd. In its configuration file (/etc/rsyslog.conf
), the following lines ensure that the server can receive syslog data from other hosts via UDP and TCP:
$ModLoad imudp $UDPServerRun 514 $ModLoad imtcp $InputTCPServerRun 514
On the other machines, I added an entry of *.* @10.0.0.254
to rsyslog.conf
so that they all send their log data to the server on 10.0.0.254.
However, the incoming syslog messages generate huge numbers of writes, and I'm worried about the SSD service life. Enter Log2Ram [1] stage left. It creates a RAM disk on /var/log
to which the central rsyslogd writes all the incoming data. Once an hour, the collected data are written to disk in one fell swoop.
Need to Talk
I installed Log2Ram by running the following command line on the log server:
git clone https://github.com/azlux/log2ram
I then changed to the directory created in the last step and executed the install.sh
script. At first the installation failed because the Mailutils package was missing, and Log2Ram insists on the ability to mail to the admin in case of problems.
Also the size of the RAM disk, 40MB by default, was too small for my setup, but this can be adapted with a manual edit of the configuration file.
Now I just have one more wish: I don't want to be restricted to viewing the logs with tail -f
on the log server console, instead I also want to inject them into a web page, just in case I feel the urge to inspect the files while I'm on the road. A small tool by the name of frontail
[2] helps me do exactly this. It is based on Node.js, so you need to install the npm
installer. You then install frontail
and launch it like this:
npm i frontail -g frontail /var/log/syslog
This starts a small web server on port 9001. Now, when I open the page in a web browser, I'm welcomed by the syslog (Figure 1). With just a little manual intervention, I can enjoy the view and an SSD that should survive for a couple of years.
Infos
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.