ndslogsave



By: ChrisRandles

July 27, 2009 4:37 pm

Reads: 269

License:
Free

Download ndslogsave.zip

For eDirectory on Linux – A little automatic bash script to copy multiple ndstrace log files before the log file reaches its maximum size and is over-written.

Script has 2 embedded variables, MAXSIZE and FILECOUNTER:

MAXSIZE is how big the log file has to be before it is copied/saved.

If the log file size is set to 10mb, then you should set this value to say 9,000,000 bytes, so that the copy process has time to make a copy of the log file BEFORE the log file reaches its maximum size and is overwritten.

NOTE: Because this script copies a ‘live’ log file YOU WILL NOT GET ALL DATA GOING IN TO THE LOG FILE. The data amount between the MAXSIZE and the actual maximum size of the log file will be lost. In most cases this is not a problem.

The actual saved log file size will vary depending on when the script detected the MAXSIZE was reached and how quickly the log file is expanding.

If the log files saved are much smaller than expected, you have probably set the MAXSIZE variable ‘too big’, and the live log file is being overwritten before the script has time to copy the file.

FILECOUNTER is set to the number of log files to be saved (if set to zero script will continue until ended by CTRL-C)

The saved log files are named: <DATE and TIME>_<HOST NAME>_ndstrace.log – File names are unique.

NOTE: Setting the ndstrace log file maximum size to its max of 100MB, and setting the script variable FILECOUNTER to 20, would need maximum free disk space on the log file system of 20*100MB = 2GB (you would actually need less than this but to be safe use this calculation).

How to change the log file size in ndstrace:

Go in to ndstrace by executing ‘ndstrace’ at a terminal window.

Whenever you enter the ndstrace program, it automatically switches on tracing, so execute ‘ndstrace off’.

To set the trace file log size to its maximum of 100mb execute ‘set ndstrace=*M100000000′.

Verify the log file size has been set correctly (just use ‘ndstrace’ to refresh your view).

Exit ndstrace by using the ‘exit’ command.

Get ready and start script:

Copy ndslogsave.sh to the /var/log/novell/eDirectory/log directory.

Change your current working directory to /var/log/novell/eDirectory/log

Make sure you have the execution permission set on the script to enable you to run it (use chmod to change permissions).

Go in to ndstrace by executing ‘ndstrace’ at a terminal window.

Whenever you enter the ndstrace program, it automatically switches on tracing, so execute ‘ndstrace off’.

Check the setting for ‘Trace File is’. If it’s set to ‘OFF’ then execute ‘ndstrace file on’.

Exit ndstrace by using the ‘exit’ command.

Delete the current ndstrace.log file (if it exists) from /var/log/novell/eDirectory/log

Go back in to ndstrace by executing ‘ndstrace’ at a terminal window. This will start the capturing to the log file.

Exit ndstrace by using the ‘exit’ command.

Run the ndslogsave script by executing ./ndslogsave.sh

NOTE: If you delete ndstrace.log whilst nsdtrace is capturing trace data,the log file will not be recreated until you go in to the ndstrace program and stop and restart trace capturing.

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

Tags: ,
Categories: Cool Tools, eDirectory

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.

Comment