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)

sleep 120 &
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 ACCOUNT@SERVER-1-IP:'/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 ACCOUNT@SERVER-2-IP:'/var/log/LOGFILE'

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


Popular posts from this blog

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

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

How can I chroot sftp-only SSH users into their homes?