Viewer for Log XML files

Last Update: 20 Sept 2002

This document describes how to install and use version 2.1.3 of the Log XML Viewer.

Table of Contents


   Overview
   Packaging
   Install Instructions
   Uninstall Instructions
   Usage
   Examples
   Error Handling
   Troubleshooting

Overview

Tivoli applications support a common XML format in which they log messages and traces. This common format is called LOG XML. This viewer processes logs in that format.

The viewer can filter messages and traces by time window, severity, thread id, component, etc, correlate messages and traces produced by different products, and convert the logged messages into ASCII or HTML for presentation. Visual cues are associated with error and warning messages.

The viewer is a java program, which requires JVM 1.2.2 or better, and comes with an InstallShield Wizard to aid in installation.

Packaging

The package setup.jar contains the following files:
  • imperative_ie5.css
  • imperative_netscape47.css
  • imperative_subset.css
  • viewer.bat
  • viewer.sh
  • viewer.jar
  • jlog.jar
  • regex4j.jar
  • xercesImpl.jar
  • xmlparserAPIs.jar
  • LICENSE
  • This product includes software developed by the Apache Software Foundation (http://www.apache.org/).

    Install Instructions

    The viewer and InstallShield Wizard are provided in setup.jar. It requires a JVM version 1.2.2 or better.

    To invoke the interactive install use the command:

    java -cp setup.jar run
    

    To invoke the console install, Use the command:

    java -cp setup.jar run -console
    

    To invoke the silent install, Use the command:

    java -cp setup.jar run -silent -P bean5.installLocation=<location>
    

    where <location> is replaced with a directory.

    Add the location of the viewer installation and java executable to your PATH variable. For UNIX systems, give the viewer.sh execute permissions with the command in the directory where the viewer is installed:

    chmod +x viewer.sh
    

    Uninstall Instructions

    To remove the viewer, invoke the uninstall program. The uninstall program is provided in uninstall.jar, which is located in the _uninst directory, an subdirectory of the install location. It requires a JVM version 1.2.2 or better. To invoke the interactive uninstall use the command:

    java -cp uninstall.jar run
    

    Usage

    The viewer may be invoked by using the provided wrapper script (recommended) or by calling java directly.

    Wrapper Script

    The command assumes the viewer.bat (DOS), or viewer (shell) is in your PATH environment variable. The script will determine its location, and use that to set the CLASSPATH and VIEWER_HOME. If you are using a UNIX system, replace "viewer" below with "viewer.sh".

    viewer [(-q Query_String) | (-f filename)]
            [-s (text | html)]
            [-h]
            <input.xml> [<input.xml>*]
    where
    -q is a parameter to specify a query string.
       See below for description of the query string syntax.
       Only one of -q or -f can be specified.
    -f is a parameter to specify a file which contains a query string.
    -s allows either text or html output (default html).  The html output
    will be in UTF-8 encoding.  The text format will be in the default
    encoding of the console where the command is issued.
    -h prints the usage statement.
    All other arguments are interpreted as log xml input files. 
    When multiple input files are given, the log and trace records
    will be merged based on the timestamp.
    

    Direct JVM Usage

    The command assumes the CLASSPATH environment variable includes jlog.jar, viewer.jar, regex4j.jar, and xerces.jar, and that java is in your PATH environment variable.

    java -DVIEWER_HOME=
    	[-DTRACE=DEBUG_MIN] 
    	[-DSHOWTITLE=TRUE]
            -cp "viewer.jar:jlog.jar:xercesImpl.jar:xmlparserAPIs.jar:regex4j.jar"
            com.tivoli.log.viewer.Cli
            [(-q Query_String) | (-f filename)]
            [-s (text | html)]
            [-h]
            <input.xml> [<input.xml>*] 
    where
    -DVIEWER_HOME is a system property that defines the location of the
       stylesheet (.css) files. These stylesheets will be embedded in 
       the HTML file.
    -DTRACE is a system property that defines the level of tracing.
       The default is DEBUG_MIN, but DEBUG_MID and DEBUG_MAX
       are also valid settings.
    -DSHOWTITLE is a system property that directs the HTML formatter
       to either include or omit the title.  The default is to include 
       the title.  The title consists of a comma separated list
       of input filenames.
    -cp "viewer.jar:jlog.jar:xercesImpl.jar:xmlparserAPIs.jar:regex4j.jar"
       indicates to the JVM which jar files must be availble for the viewer
       to function.  This example shows the use of a UNIX separator ':'.  In
       DOS, this would be ';'.  If these jar files are not in the current 
       directory, it is the responsibility of the user to give the full path 
       to each jar file, rather than just the name of the files as shown.
    -q is a parameter to specify a query string.
       See below for description of the query string syntax.
       Only one of -q or -f can be specified.
    -f is a parameter to specify a file which contains a query string.
    -s allows either text or html output (default html).  The html output
    will be in UTF-8 encoding.  The text format will be in the default
    encoding of the console where the command is issued.
    -h prints the usage statement.
    All other arguments are interpreted as log xml input files. 
    When multiple input files are given, the log and trace records
    will be merged based on the timestamp.
    

    Terminology


  • query string - A string provided by the user, which defines what will be in the output, and the format of that output.
  • log record - A single coherent entry in the log file. The log record contains several fields (time, server, logText, etc). A log should describe activities of the user, or the visible behavior of the program
  • trace record - A single coherent entry in the trace file. Similar to the log record. A trace record will describe the internal activity of the application. Trace is of interest to a programmer, however not generally of use to the end user.
  • column header - This term borrows from database terminology. Each log or trace record contains multiple fields, some more interesting that others. The term column header will be used to refer to these items.
  • filter predicate - Filter predicate describes an expression which the viewer will use to determine if a particular record will be present in the output. Contrast with column header, which describes a field within the record.
  • Query String

    The query string will have the following format:

    select column [,column] where Filter_Predicate
    

    Following the reserved word "select" is one or more column headers. These are the elements of the log or trace records that will be apparent in the output. A timestamp is always displayed in the output for each record. After the reserved word "where" is a filter predicate. The filter predicate determines which records will be present in the output. The default query string is "select default where true".

    These are the column names(not case sensitive):

  • all - select all columns
  • default - the default columns are Time, Severity, Message Id, LogText, Server, Product Id, Component, and Product Instance.
  • Element - String, Either Message or Trace
  • Time - String, localized time
  • Millis - long int, time in milliseconds
  • Server - String, name or ip address
  • ServerFormat String, eg TCP/IP
  • Client - String
  • ProductId - String three letters
  • Component - String
  • ProductInstance - String
  • LogText - String
  • SourceFile - String, the name of the source file where the event was generated
  • SourceMethod - String, the name of the method which generated the event
  • SourceLine - String, the line number where the event was generated
  • CorrelationId - String
  • Principal - String
  • Process - String
  • Thread - String
  • Exception - String
  • MessageId - String
  • TraceLevel - String
  • Severity - String
  • LogAttribs - Space separated key value pairs
  • Filter Predicate

    A filter predicate can be an expression, or the reserved word true.

    Conditional operators used in Filter Predicate clause:

      =       Equal
      >       Greater than
      <       Less than
      >=      Greater than or equal to
      <=      Less than or equal to
      <>      Not equal to
      MATCH   *See note below
    

    * The MATCH pattern matching operator can also be used in the conditional selection of the where clause. Match is a very powerful operator that allows you to select log or trace records using regular expression syntax. This is implemented using the regex4j regular expression engine from alphaWorks Strings with special characters used in the regular expression must be in single quotes. Strings with spaces must be in single quotes.

    Boolean Operators

      OR
      AND
    

    Boolean operators can be used to conjoin two expressions. They must be of the form (expression) AND (expression). The parenthesis are required around each expression.

    The Keyword true

    The keyword true is a complete filter expression, which indicates that filtering is disabled, and that every log and trace record should be present in the output.

    Examples

    The following query will show the default field list of all message and trace records in html, to sample.html.

    viewer sample.xml > sample.html

    The following query selects for display all fields with a correlation id of 12. The output is sent to stdout.

    viewer -q"select all where CorrelationId = 12" -stext sample.xml

    The following example displays all fields with a timestamp less than 1007067881373. Timestamp is the only column name that takes a numeric argument instead of a string. Output is in text format, written to stdout.

    viewer -q"select all where Millis < 1007067881373" -stext sample.xml

    The following example will display only the server and product id, where the boolean expression is met. Since boolean operators are present, parenthesis have been used to indicate order of operator evaluation. Input is merged from the three files "sample1.xml" "sample2.xml" and "sample3.xml".

    java -DVIEWER_HOME="./" -DTRACE="DEBUG_MAX" com.tivoli.log.viewer.Cli -q"select server,ProductId where (messageid MATCH 'FRWEP00[10-45]') AND ((server = 'joe') OR (severity = 'ERROR'))" sample1.xml sample2.xml sample3.xml

    This example illustrates filtering on a Log Attribute. The output will contain log records which have a Log Attribute with the name FNG and value 123.

    viewer -q"select default where LogAttribs MATCH 'FNG=123'" sample.xml

    Error Handling

    The query string will be verified for correctness, and processing will halt if the query string is malformed. Validation of the column labels will be done. Validation of each command line argument is done, and if an invalid argument value is specified, processing will halt. If one of the input Log XML files is malformed, there wil be no further attempt to read input from that file, however any other input files will be processed. Input files will not be checked against the PDLog.dtd, so if a file has an entry that is not specified in PDLog.dtd, the entry will be ignored. The opening and closing <PDLog> tags are not required in the input file, as the viewer inserts these into the input files.

    Troubleshooting

    Boolean operators require parenthesis

    The following example demonstrates the strictness of the boolean expressions.

    viewer -q"select default where (server = 'joe') AND (element = 'trace') AND (messageID='FRWEP0001E')"

    This results in the following error:

    2002.04.10 14:52:19.755 com.tivoli.log.viewer.QueryTree labels Tivoli IVR 1 log viewer jrowlan2.dev.tivoli.com IP IVR0019E unexpected character after query: AND

    The solution is to ensure that each boolean expression has the form: (expression) AND (expression). So in this case, we could change the example to:

    viewer -q"select default where ((server = 'joe') AND (element = 'trace')) AND (messageID = 'FRWEP0001E')"

    Using quotes in the Query String

    The following example attempts to make a query using the match operator. The query string is not delimited by double quotes.

    viewer.sh -qselect default where logText match ^get *.xml

    This results in the following error:

    2002.03.29 14:21:47.014 com.tivoli.log.viewer.QueryTree labels Tivoli IVR 1 log viewer jrowlan2.dev.tivoli.com IP IVR0017E missing column label

    When a query is incomplete, the viewer issues an error to indicate which component of the query sting was found to be missing. In this example It was expecting to find a column label, when the string ended. Without double quotes around the query string, this shell will provide each word of the query in a different argument, resulting in the string appearing as "select". We can correct the situation by adding double quotes around the query string like so:

    viewer.sh -q"select default where logText match ^get" *.xml

    Upon running the new query, we get the following error:

    2002.03.29 14:18:53.423 (null) main Tivoli IVR 1 log viewer jrowlan2.dev.tivoli.com IP IVR0021E Invalid character ^ found in query string.

    The query syntax allows values to be enclosed in single quotes. This signals to the viewer that what is inside the single quote, is a value which does not need to be parsed. We must use the single quote in this case, or the viewer will report an error.

    viewer.sh -q"select default where logText match '^get'" *.xml

    Another case where single quotes around the term is needed, is if the term contains spaces.

    Filenames with spaces

    Occasionally, directory names and file names have spaces. Since the viewer accepts space separated file names, this creates ambiguity.

    For example:

    viewer a b/c
    
    could be interpreted as either two files, "a" and "b/c", or a single file, "c", in subdirectory "a b". To resolve this, the user must use quotes around any file name which contains spaces.

    For example:

    viewer "a b/c"
    
    indicates that the user is specifying a file named "c" in subdirectory "a b", while
    viewer a b/c
    
    indicates that the user is specifying two files, "a" and "b/c".

    Enabling Viewer Tracing

    Tracing is enabled for the viewer using the java System property "trace". This needs to be passed on the java command line before the classname is given. To enable tracing for the viewer, you will either edit the viewer script (viewer.bat or viewer.sh), or run the command without the use of the script. For example (assuming the CLASSPATH has each of xerces.jar regex4j.jar viewer.jar jlog.jar):

    java -Dtrace=DEBUG_MAX com.tivoli.log.viewer.Cli sample.xml

    A file will be created in the current directory with the name: logViewerTrace.log. If you would like to view this file with the viewer, rename the file first, or the viewer will go into a loop!