Personal tools
You are here: Home DB2 Problem Resolution Tools and Technicals of Troubleshooting db2diag - db2diag.log analysis tool command
Navigation
Log in


Forgot your password?
 
Document Actions

db2diag - db2diag.log analysis tool command

Parameters to use the db2diag tool to analyze your db2diag.log file

This utility is a tool to filter and format the db2diag.log file.


Command syntax


db2diag  [ filename  -n nodeList -e errorList -l | -level levelList -c 
| -count -v |-invert -o pathName -H historyPeriod:historyBegin -t
startTime:endTime |
-g fieldPatternList | -gi fieldPatternList |
-gv fieldPatternList | -giv fieldPatternList |
-A | -archive dirName ]

Command parameters


<filename>
Specifies one or more space-separated path names of DB2 diagnostic logs to be processed. If the file name is omitted, the db2diag.log file from the current directory is processed. If the file is not found, a directory set by the DIAGPATH variable is searched.

-n | -node nodeList
Displays only log messages with the database partition numbers listed.

-e | -error errorList
Displays only log messages with the error numbers listed.

-l | -level levelList
Finds all records with a specified severity level from a list of severity levels containing one or more comma separated text values, namely: Info, Warning, Error, Severe, Critical and Event.

-c | -count
Displays the number of records found.

-v | -invert
Inverts the pattern matching to select all records that do not match the specified pattern.

-o | -output pathName
Saves the output to a file specified by a fully qualified pathName.

-filter fieldPatternList | -g fieldPatternList
fieldPatternList is a comma-separated list of field-pattern pairs in the following format: fieldName operator searchPattern.
The operator can be one of the following:
=
Selects only those records that contain matches that form whole words. (Word search.)
:=
Selects those records that contain matches in which a search pattern can be part of a larger expression.
!=
Selects only non-matching lines. (Invert word match.)
!:=
Selects only non-matching lines in which the search pattern can be part of a larger expression.
^=
Selects records for which the field value starts with the search pattern specified.
^=
Selects records for which the field value does not start with the search pattern specified.

-gi fieldPatternList
Same as -g, but case-insensitive.

-gv fieldPatternList
Searches for messages that do not match the specified pattern.

-gvi | -giv fieldPatternList
Same as -gv, but case-insensitive.

-H | -history historyPeriod:historyBegin

Displays the history of logged messages for the specified time interval. This option can be specified with the following options:
historyPeriod
Specifies that logged messages are displayed starting from the most recent logged record, for the duration specified by historyPeriod. The historyPeriod option is specified using the following format: Number timeUnit, where Number is the number of time units and timeUnit indicates the type of time unit: M (month), d (day), h (hour), m (minute), and s (second). The default value for Number is 30, and for timeUnit is m.
:historyBegin
Specifies that logged messages are displayed starting from the time specified by historyBegin, for the duration specified by historyPeriod. The format is YYYY-MM-DD-hh.mm.ss.nnnnnn.

-t | -time
Specifies a time stamp value. This option can be specified with one or both of the following options:
startTime
Displays all messages logged after startTime.
:endTime
Displays all messages logged before endTime.
To display messages logged between startTime and endTime, specify -t startTime:endTime. The format is YYYY-MM-DD-hh.mm.ss.nnnnnn.

-A | -archive dirName
Archives a diagnostic log file. When this option is specified, all other options are ignored. If one or more file names are specified, each file is processed individually. A timestamp, in the format YYYY-MM-DD-hh.mm.ss, is appended to the file name.

You can specify the name of the file and directory where it is to be archived. If the directory is not specified, the file is archived in the directory where the file is located and the directory name is extracted from the file name.

If you specify a directory but no file name, the current directory is searched for the db2diag.log file. If found, the file will be archived in the specified directory. If the file is not found, the directory specified by the DIAGPATH configuration parameter is searched for the db2diag.log file. If found, it is archived in the directory specified.

If you do not specify a file or a directory, the current directory is searched for the db2diag.log file. If found, it is archived in the current directory. If the file is not found, the directory specified by the DIAGPATH configuration parameter is searched for the db2diag.log file. If found, it is archived in the directory specified by the DIAGPATH configuration parameter.

Examples


 - To display all severe error messages produced by the process with the process ID (PID) 952356 and on node 1, 2 or 3, enter:

        db2diag -g level=Severe,pid=952356 -n 1,2,3

 - To display all messages containing database "SAMPLE" and instance "aabrashk", enter:

        db2diag -g db=SAMPLE,instance=aabrashk

 - To display all severe error messages containing the database field, enter:

        db2diag -g db:= -gi level=severe

 - To display all logged error messages containing the DB2 ZRC return code 0x87040055, and the application ID 916625D.NA8C.068149162729, enter:

        db2diag -g msg:=0x87040055 -l Error | db2diag -gi appid^=G916625D.NA

 - To display all messages not containing the LOADID data, enter:

        db2diag -gv data:=LOADID

 - To display only logged records not containing the "LOCAL" pattern in the application ID field, enter:

        db2diag -gi appid!:=local  or  db2diag -g appid!:=LOCAL

   All records that don't match will be displayed. To output only messages that have the application ID field, enter:

        db2diag -gvi appid:=local -exist

- To display severe errors logged for the last 3 days, enter:

        db2diag -gi "level=severe" -H 3d

 - To display all log messages not matching the "pdLog" pattern for the "funcname" field, enter:

        db2diag -g 'funcname!=pdLog'  or  db2diag -gv 'funcn=pdLog'

 - To display all severe error messages containing component name starting from the "base sys", enter:

        db2diag -l severe | db2diag -g "comp^=base sys"

 - To view the growth of the db2diag.log file, enter:

        db2diag -f db2diag.log

   This displays all records written to the db2diag.log in the current directory. Records are displayed as they are added to the file. The display continues until you press the Ctrl-C key sequence to stop it

 - To write the context of the db2diag.log into the db2diag_123.log file located in the /home/user/Logs directory, enter:

        db2diag -o /home/user/Logs/db2diag_123.log


 "db2diag -h all"   - displays help in the most complete form with detailed information about all options and usage examples



Note


By default, db2diag looks for the db2diag.log file in the current directory. If the file is not found, the directory set by the DIAGPATH registry variable is searched next. If the db2diag.log file is not found, db2diag returns an error and exits.


If you need more information and other parameters, please visit the IBM DB2 Information Center website.



Source: Info Center IBM - DB2 LUW 9.5
Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls