Storing Verbose Import Logs Long Enough for Troubleshooting
Novell Cool Solutions: Tip
By Nicoya Helm
Digg This -
Posted: 24 Aug 2005
PROBLEM: The ZENworks 6.5 workstation import log size is limited to 100000 bytes, according to TID 10093312. We needed several days' worth of verbose logs for troubleshooting. With our logging level set to the most verbose, the import log was getting overwritten every couple of hours.
SOLUTION: I wrote a bash shell script to rotate the log hourly from a Linux box (SUSE Linux Enterprise Server 9). Our server runs Native File Access, so I used samba to mount the server's sys volume in order to access the log files. If not running NFA, you might be able to use NCPMOUNT as described here.
First, mount your ZENworks import server's sys volume on the Linux box you're running the script on. I mounted the sys volume to my linux box with the command:
mount -t smbfs -o username=myname //server/sys /mnt/server
Then, create a small script called zenrotate.sh with the following lines:
- date=`/bin/date "+%m%d%Y"`
- time=`/bin/date "+%H"`
- mv /mnt/server/zenworks/zenwsimp.log /mnt/server/zenworks/zenwsimp-$date-$time.log
You can modify the date commands to achieve a naming convention that suits your needs. Mine ended up in the format:
Then, add a cron job to /etc/crontab to run your script every hour (or however often you want). You must run the job as a user that has rights to modify files on the mounted volume:
1 * * * * root /usr/local/scripts/zenrotate.sh
We didn't need to worry about removing or compressing old logs, but you could also add that function to the script.
If you have any questions you may contact Nicoya at email@example.com
If you don't have a handy Linux box to run this on, one option would be to use Perl on your NetWare server: save this script --
# Perl Script to rename import log ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time); $mymonth=$Month+1; $myyear=$Year+1900; $mydate="$mymonth-$Day-$myyear"; rename "sys:/zenworks/zenwsimp.log","sys:/zenworks/zenwsimp-$mydate-$Hour.log";
-- as, say, zenimport_logrotate.pl in sys:perl\scripts, then update SYS:\ETC\CRONTAB. Using Nicoya's example, the command would be:
1 * * * * perl zenimport_logrotate.pl --noscreen
(The --noscreen ensures you don't have a "press any key..." screen remaining.)
Alternatively, schedule the command using iManager, if supported by your version of NetWare.
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com