Multiple tail via ssh

I just wrote simple script to remotely monitor logs of many servers and log files and display on screen with colors depends on event. You can also add parameter to receive emails when event occurs.

Script will automatically login into server via ssh and start tail.

Another great tool CHIP 

Also I use sshpass for automatic login (for security reason you can write password in separate file)

#!/bin/bash
sleep 120 &
pid="$!"
sleep 120 &
pid="$pid $!"
echo "my process pid is: $$"
echo "my child pid list is: $pid"

/usr/bin/sshpass -p PASSWORD /usr/local/bin/chip -f -m2='LOG-EVENT-1' -s2='YELLOW on_blue' -m3='LOG-EVENT-2' -s3='WHITE' -s1 [email protected]:'/var/log/LOGFILE'

/usr/bin/sshpass -p PASSWORD /usr/local/bin/chip -f -m2='LOG-EVENT-1' -s2='YELLOW on_blue' -m3='LOG-EVENT-2' -s3='WHITE' -s1 [email protected]:'/var/log/LOGFILE'

trap 'echo I am going down, so killing my processes..; kill $pid; exit' SIGHUP SIGINT  SIGQUIT SIGTERM

Comments

Popular posts from this blog

Securing the Pi-hole with fail2ban to prevent DNS Amplification attacks

How to clean DB from old logs in Magento 1.x

Python pxssh failed on login. could not set shell prompt