logGrab is a simple bash script that builds a time/date stamped archive containing a number of log items commonly requested when raising a TAC case. It is designed to simplify the process of collecting data from multiple sources within EOS and packing them into a single file for easy upload.
The script can be easily extended/adapted and may be integrated easily with other EOS features such as the CLI scheduler and Advanced Event Manager.
#!/bin/bash # logGrab - Automatic Log Collector v0.3 LOGNAME=logGrab-$HOSTNAME-$(date +%Y-%m-%d.%H%M%S) mkdir /mnt/flash/$LOGNAME cd /mnt/flash/$LOGNAME ls -alR /persist/sys > persist-sys-contents ls -alR /mnt/flash > flash-contents ls -alR /var/log/agents > agent-contents ls -alR /var/core > core-contents df > disk-utilization cp /mnt/flash/*config . cp -r /var/log/agents . cp -r /var/core . cp -r /mnt/flash/schedule/tech-support . sudo cp /var/log/messages . Cli -p15 -c "show tech" > ./show-tech Cli -p15 -c "show tech ribd" > ./show-tech-ribd cd /mnt/flash zip -r $LOGNAME.zip $LOGNAME rm -R $LOGNAME
logGrab generates a ZIP archive named by the host and time of execution:
[admin@Arista flash]$ ls -l total 922100 drwxrwx--- 6 root eosadmin 4096 Feb 17 16:17 . drwxr-xr-x 3 root root 100 Feb 17 14:59 .. ... -rwxrwx--- 1 root eosadmin 427 Feb 17 16:16 logGrab -rwxrwx--- 1 root eosadmin 82583 Feb 17 16:17 logGrab-7050S-64-2012-02-17.161638.zip
You can download the script from here!