#!/bin/bash

SD='/tmp/syslogData'
DATE=$(date +%Y%m%d%H%M%S)

if [ -d "$SD" ]; then
	rm -r $SD
fi

mkdir $SD

cp /etc/rsyslog.conf $SD/.
cp -r /etc/rsyslog.d $SD/.
cp -r /etc/sysconfig $SD/.
cp -r /etc/rc.d $SD/.

ps -ef > $SD/process.txt

ls -l /usr/local/nmis8/logs/ > $SD/nmisLogDir.txt
tail -10000 /var/log/messages > $SD/messages.txt

LOGS=$(ls /usr/local/nmis8/logs/ | egrep *.log$)

for i in $LOGS; do
	tail -10000 /usr/local/nmis8/logs/$i > $SD/$i
done

tar -zcvf syslogData$DATE.tar.gz $SD 

rm -r $SD

echo ""
echo "Please find syslogData$DATE.tar.gz and send to Chris.  Thanks!"

echo ""
