cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1435
Views
0
Helpful
2
Replies

Syslog in CiscoWorks

b.petronio
Level 3
Level 3

Hi,

I was browsing in the CiscoWorks on my client and i realize that the syslog file, was about 900MB, (text file)

I wanna reduce this file, can i simple change the name of the file, and CW creates another one? Or i have to create another one empty with the same name.

There are any process that do this automatically ?

CW based on Windows 2003

1 Accepted Solution

Accepted Solutions

David Stanford
Cisco Employee
Cisco Employee

You should look at using the logrot.pl utility which is found in NMSROOT/CSCOpx/bin

The way it works in explained in the online help, but it allows you to rotate and archive log files automatically without causing any problems to processes like SyslogAnalyzer

From online help:

The logrot utility helps you manage the log files in a better fashion.

Logrot is a log rotation program that can:

Rotate log when CiscoWorks is running.

Optionally archive and compress rotated logs.

Rotate log only when it has reached a particular size.

Logrot helps you add new files easily. Logrot should be installed on the same machine where you have installed Common Services.

Configuring Logrot

To configure logrot:

Enter NMSROOT \ bin\perl.exe NMSROOT \bin\logrot.pl -c (On Windows)

Run /opt/CSCOpx/bin/logrot.pl -c (On UNIX)

The logrot configuration menu appears. You have the following options:

Edit variables.

Edit log files.

Quit and save changes.

Quit without saving change.

Select Edit variables option to set your Backup Directory.

If you do not set a backup directory, each log will be rotated in its current directory.

Select Edit log files option to add log files you wish logrot to rotate.

You can specify log files using fully-qualified or relative paths. If a relative path is specified, and the log file does not exist in that path, the default log file path for your operating system will be added during rotation (for example, /var/adm/CSCOpx/log on UNIX).

Specify the number of archive revisions. If you do not want to keep any archives, enter 0 (the default) for this option.

Specify the maximum file size. The log will not be rotated until this size is reached. The unit is in kilobytes (KB). The default is 1024 KB or 1 MB.

Specify the file compression type to be used. It can be:

Z--UNIX

gz--GNU gzip (available by default on Windows only)

bz2--bzip2 (available by default on Solaris8 and above only).

When deleting logfiles, you can choose to delete an individual file, a list of files, or a all files matching a certain pattern.

For example, 1-3 means delete files numbered 1 through 3. a list of comma-separated file numbers, for example, 1,21, means delete files numbered 1 and 21. A pattern string *.log means delete all files that match the pattern *.log .

You can also specify the special pattern, * , which means delete all logfiles in the configuration.

Running Logrot

To run Logrot enter either of the following:

On Windows:

Enter NMSROOT \bin\perl.exe NMSROOT \bin\logrot.pl

On Unix:

Run /opt/CSCOpx/bin/logrot.pl

You can schedule log rotation so that the utility works on a specified time and day.

The following command line flags are accepted:

-v options to get verbose messages.

-s option shuts down dmgtd before rotating logs.

The Restart Delay variable controls the waiting duration (in seconds) before proceeding, after dmgtd is shutdown. This option is only used if the -s argument is given to logrot. The default delay is 60 seconds.

-c option reruns the configuration tool.

View solution in original post

2 Replies 2

David Stanford
Cisco Employee
Cisco Employee

You should look at using the logrot.pl utility which is found in NMSROOT/CSCOpx/bin

The way it works in explained in the online help, but it allows you to rotate and archive log files automatically without causing any problems to processes like SyslogAnalyzer

From online help:

The logrot utility helps you manage the log files in a better fashion.

Logrot is a log rotation program that can:

Rotate log when CiscoWorks is running.

Optionally archive and compress rotated logs.

Rotate log only when it has reached a particular size.

Logrot helps you add new files easily. Logrot should be installed on the same machine where you have installed Common Services.

Configuring Logrot

To configure logrot:

Enter NMSROOT \ bin\perl.exe NMSROOT \bin\logrot.pl -c (On Windows)

Run /opt/CSCOpx/bin/logrot.pl -c (On UNIX)

The logrot configuration menu appears. You have the following options:

Edit variables.

Edit log files.

Quit and save changes.

Quit without saving change.

Select Edit variables option to set your Backup Directory.

If you do not set a backup directory, each log will be rotated in its current directory.

Select Edit log files option to add log files you wish logrot to rotate.

You can specify log files using fully-qualified or relative paths. If a relative path is specified, and the log file does not exist in that path, the default log file path for your operating system will be added during rotation (for example, /var/adm/CSCOpx/log on UNIX).

Specify the number of archive revisions. If you do not want to keep any archives, enter 0 (the default) for this option.

Specify the maximum file size. The log will not be rotated until this size is reached. The unit is in kilobytes (KB). The default is 1024 KB or 1 MB.

Specify the file compression type to be used. It can be:

Z--UNIX

gz--GNU gzip (available by default on Windows only)

bz2--bzip2 (available by default on Solaris8 and above only).

When deleting logfiles, you can choose to delete an individual file, a list of files, or a all files matching a certain pattern.

For example, 1-3 means delete files numbered 1 through 3. a list of comma-separated file numbers, for example, 1,21, means delete files numbered 1 and 21. A pattern string *.log means delete all files that match the pattern *.log .

You can also specify the special pattern, * , which means delete all logfiles in the configuration.

Running Logrot

To run Logrot enter either of the following:

On Windows:

Enter NMSROOT \bin\perl.exe NMSROOT \bin\logrot.pl

On Unix:

Run /opt/CSCOpx/bin/logrot.pl

You can schedule log rotation so that the utility works on a specified time and day.

The following command line flags are accepted:

-v options to get verbose messages.

-s option shuts down dmgtd before rotating logs.

The Restart Delay variable controls the waiting duration (in seconds) before proceeding, after dmgtd is shutdown. This option is only used if the -s argument is given to logrot. The default delay is 60 seconds.

-c option reruns the configuration tool.

Tks,

Already see logrot in directory, i will test it later.

Petr?nio