Home » Scripts » Shell Script to Tail Today’s Syslog-NG logs

Shell Script to Tail Today’s Syslog-NG logs

Shell Script to Tail Today's Syslog-NG logsHere is a simple shell script (one-liner) to automatically start tailing today’s syslog-ng logs for a single device.

Shell Script to Tail Today’s Syslog-NG logs

Laziness is powerful, so if you are tired of typing the full path to today’s syslog-ng log files, for your device, here is a simple method to use it. You will need to change the IP Address to the address of your device (or hostname, if applicable).

tail -f /Logs/firewalls/`/bin/date +\%Y`/`/bin/date +\%m`/`/bin/date +\%Y-%m-%d`.log

If you like a little color, when displaying your logs, here is the same example using colortail instead of tail.

colortail -f /Logs/firewalls/`/bin/date +\%Y`/`/bin/date +\%m`/`/bin/date +\%Y-%m-%d`.log

Enjoy logging in and running ./logtail.sh instead of typing in the full command line every time!


Was this helpful?
If you found my posts interesting, or I helped you figure something out, please consider tossing me a tiny gratuity for my time, research, to help offset the web hosting/development costs or to buy me a cup of coffee.

* This post may contain affiliate links. This means that I “might” receive a tiny amount of money, if you make a purchase using one of our links. It does not cost you anything extra, and helps us defray the costs of hosting and maintaining this site.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.