ndslogsave

ndslogsave

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.
Labels (1)
Tags (2)
Attachments

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
3 of 3
Last update:
‎2020-03-10 17:31
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.