IDM log archiver



By: jimgoodall

May 9, 2008 11:41 am

Reads: 312

License:
Free

Need to keep your Linux based IDM log files for troubleshooting?

This script zips your log files up, keeping a zip file for each day.

#!/bin/bash
cd $2
if  [ -e $1 ] ; then
	strFile=`date +%d%m%y`
	myHost=`hostname`
	strFile=$strFile"-"$myHost".zip"
	# echo $strFile
	strTime=`date +%H%M%S`
	# echo $strTime
	mv $1 $strTime$1
	zip $strFile -q -9 -o -m $strTime$1
else
	echo "file not found"
fi

Simply call the script passing the name of the log file you wish to archive and the path to your log files as command line parameters.

You can run this in your crontab, calling it every minute (or whatever period suites you) When the log file rolls over the _1.log file will be renamed with a time stamp and added to todays zip file. If the log file has not yet rolled the script just exits.

Example:

log_archiver.sh Driver1_1.log /IDMLOGS/

Enjoy!

Cheers

Jim

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Tags:
Categories: Cool Tools, Identity Manager

Disclaimer: As with everything else at NetIQ Cool Solutions, this content is definitely not supported by NetIQ, so Customer Support will not be able to help you if it has any adverse effect on your environment.  It just worked for at least one person, and perhaps it will be useful for you too.  Be sure to test in a non-production environment.

2 Comments

  1. By:marklamont

    what a great script, so usefull for keeping track of all the driver traffic, so easy to keep these rolled up files in a central location for auditing and legal purposes.

  2. By:wildpitch

    Most excellent, would be great if this replaced invalid windows chars in the renamed log name.

Comment