Monday, March 9, 2009

TheTivoli Storage Manager Activity Log

Tivoli Storage Manager keeps track of all of the server's activity in a database table named actlog, or activity log. The question I was asked (which, of course, triggered this post) is whether entries in this log can be deleted. The answer is no. Individual entries cannot be removed and the log as a whole cannot be cleared. With that said, there are ways to restrict either the amount of data stored in the log or the amount of data displayed from the log.

Restricting the Actlog Size:

There are two ways to restrict the size of the activity log or to shit it off entirely. The first of these is by days of retention:

set actlogretention 1 mgmtstyle=date

This command says to keep activity log info for 1 day. The number 1 can be replaced by any value from 0 to 9999 to indicate how many days of log info to keep. If set to 0, then nothing is retained and the log is efectively shut off. This value can be changed as desired. So if something is going to be done that will generate a large number of activity records, just set it to 0 and set it back when done.

The second way to restrict it is by size (I will use the shorthand for this example):

s act 1 m=s

This version of the command is to set the mgmtstyle (m) to size. The example will keep the activity log from exceeding 1 M in size. Again, the valid vlaues are 1 to 9999.

Restricting the Actlog Query:

If restricting the size is not possible then restricting the results from the query is very possible. There are two ways to query the information from the activity log. The most common is the

query actlog (q act)

The second is to use the SQL version to do:

Select * from adsm.actlog

(The biggest drawback of the second format is that the data is returned with 1 column per line)

Both will display the same information in a different structure. And both can be filtered. The Query actlog can be given a date and time filter with the begin and end data and time or by use of the search= parameter. The Select can be filtered the same way as any SQL by designating a Where clause. This can be used if there are a large number of log records that are not really wanted in the returned data. Snad while the select command returns the dater in a bulkier format, it does a better job of filtering the data thatn the seach= of the query option since filters such as Like, In, Not In and others like these are available.

One final thought on querying the TSM Activity Log is that if you will be doing a similar query filter on the log records ona regular basis, this query could be saved as a script and run as needed. For example:

def script QuerySession set sqldisplaymode wide Line=001

upd script QuerySession select date_time, message from adsm.actlog where msgno in (0482, 0407) L=002

After entering the above lines into the command line client (dsmadmc), the query will be saved for future use and can be executed by the command

run QuerySession

which will return all the messages in the activity log with the message numbers ANR0482W and ANR0407I. Various scripts could be saved and executed for various sub-queries in the activity log. (See one more reason I like the command line?) Scripts are very handy in this manner and a future post will be onde on their use.

So, bottom line is that once activity log messages are stored, they are stored for the duration of the retention method definition (size or days) and TSM has no method in place to remove them. But the data returned from an activity log query can be controlled. (And try out the command line interface. While intimidating because there is no point and click, it is not hard to get used to. Makes people think you know what you are doing too.)

1 comment:

  1. hello, thanks for the knowledge sharing.
    what if I want to remove activity logs older than one year. or you can say I want to remove activity logs of year 2011.