View log files in Webmin

Q We had a Fedora-based solution set up as an email, DNS and firewall server for an office of eight people. We manage the server mostly through Webmin, and we have our phone system wired to the server's serial port where call activity gets written to the log file /home/phone/cdr.current. A Cron job emails the previous day's activity daily while we review current telephone activity over SSH a number of times a day.cdr.current gets deleted automatically at the end of each month. After a week it is already substantially long, and too long to view entirely over SSH. Is it possible to view an arbitrary log file through Webmin to avoid additional software being written or installed? We are trying to avoid both unnecessary SSH access and additional software being installed.

A The shell using tail -n would return the last 'n' lines of the log file. This in turn could be conveniently piped into tac to reverse the text, effectively listing the latest entries at the very top.

tail -n 200 /home/phone/cdr.current | tac

Webmin, under the Options tab, makes such commands easily executable. Here is a possible configuration option:

Definition = View CDR
Command = /usr/bin/tail -n 200 /home/phone/cdr.current | /usr/bin/tac
Run in directory = /tmp
Run as user = Webmin User
Command outputs HTML = No
Maximum time to wait for command = 5 seconds

Saving the configuration creates a View CDR button, which should provide the functionality.

Back to the list