BinaryLog command options

Use the binaryLog command to view or copy the contents of a binary logging repository, or list the available server process instances in the repository. The binaryLog command is equivalent to the logViewer command in the profile bin directory of the traditional application server.

The binary log and trace facility writes to a repository in a binary format. You can view, query, and filter the repository by using the binaryLog command. The binaryLog command provides options for quickly converting repository contents into a text file in various formats, such as basic and advanced formats. The command also provides options to make getting the data that you need from the logs easier. For example, you can filter what log records you want by level, logger name, message or date and time.

Syntax

The command syntax is as follows:

binaryLog action {serverName | repositoryPath} [options]

The value of options is different based on the value of action.

Parameters

The following actions are available for the binaryLog command:

view
Read a repository, optionally filter it, and create a version that users can read.

The command syntax is as follows:

binaryLog view {serverName | repositoryPath} [options]

serverName

Specify the name of a Liberty server with a repository to read from.

repositoryPath

Specify the path to a repository to read from. This path is typically the directory that contains both the log data and trace data directories.

Note: Specify on the command line a value for serverName and a value for repositoryPath. Otherwise, the task runs against the default server instance, defaultServer, if it exists.

Filter options:

All filters are optional. When multiple filters are used, they are logically ANDed together.

  • --minDate=value

    A filter based on a minimum record creation date. The value must be specified as either a date (for example --minDate="23/01/17") or a date and time (for example --minDate="23/01/17 17:39:53:100 EST").

    You can also enter the date and time in ISO-8601 format. For example, enter --minDate="2017-01-23" or --minDate="2017-01-23T17:39:53.100-0500".

  • --maxDate=value

    Filter based on maximum record creation date. Value must be specified as either a date (for example --maxDate="2/20/13") or a date and time (for example --maxDate="2/20/13 16:47:21:445 EST").

    You can also enter the date and time in ISO-8601 format. For example, enter --maxDate="2017-01-23" or --maxDate="2017-01-23T17:39:53.100-0500".

  • --minLevel=value

    Filter based on minimum level. Value must be one of FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --maxLevel=value

    Filter based on maximum level. You must specify on of the following values: FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --includeLogger=value[,value]*

    Include records with specified logger name. The value can include * as a wildcard.

  • --excludeMessage=value

    Exclude records with the specified message. The value can include * as a wildcard.

  • --includeMessage=value

    Filter based on message name. The value can include * as a wildcard.

  • --includeThread=value

    Include records with specified thread ID. Values must be in hexadecimal (for example, --includeThread=2a).

  • --includeExtension=name=value[,name=value]*

    Include records with specified extension name and value. The value can include * or ? as a wildcard. To include a comma in the value, you must use "\,"

  • --includeInstance=value

    Include records from the specified server instance. Value must either be "latest" or be a valid instance ID. Run this command by using the listInstances action to see a list of valid instance IDs.

Monitor option:
--monitor

Continuously monitor the repository and output new content as it is generated.

Output options:
  • --format={basic | advanced | CBE-1.0.1}

    Specify the output format to use. "basic" is the default format.

  • --encoding=value

    Specify the character encoding to use for output.

  • --isoDateFormat

    Specifies that the ISO-8601 date and time format is used for output.

copy
Read a repository, optionally filter it, and write the contents to a new repository.
The command syntax is as follows:
binaryLog copy {serverName | repositoryPath} targetPath [options]
serverName

Specify the name of a Liberty server with a repository to read from.

repositoryPath

Specify the path to a repository to read from. This path is typically the directory that contains the log data and trace data directories.

targetPath

Specify the path at which to create a new repository. The targetPath must be specified. Either serverName or repositoryPath must also be specified.

Filter options:

All filters are optional. When multiple filters are used, they are logically ANDed together.
  • --minDate=value

    Filter based on minimum record creation date. The value must be specified as either a date (for example --minDate="23/01/17") or a date and time (for example --minDate="23/01/17 17:39:53:100 EST").

    You can also enter the date and time in ISO-8601 format. For example, enter --minDate="2017-01-23" or --minDate="2017-01-23T17:39:53.100-0500".

  • --maxDate=value

    Filter based on maximum record creation date. The value must be specified as either a date (for example --maxDate="23/01/17") or a date and time (for example --maxDate="23/01/17 17:39:53:100 EST").

    You can also enter the date and time in ISO-8601 format. For example, enter --maxDate="2017-01-23" or --maxDate="2017-01-23T17:39:53.100-0500".

  • --minLevel=value

    Filter based on minimum level. You must use one of the following values: FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --maxLevel=value

    Filter based on maximum level. You must use one of the following values: FINEST | FINER | FINE | DETAIL | CONFIG | INFO | AUDIT | WARNING | SEVERE | FATAL.

  • --includeLogger=value[,value]*

    Include records with specified the logger name. The value can include * as a wildcard.

  • --excludeLogger=value[,value]*

    Exclude records with specified logger name. The value can include * as a wildcard.

  • --includeMessage=value

    Filter based on message name. The value can include * as a wildcard.

  • --excludeMessage=value

    Exclude records with the specified message. The value can include * as a wildcard.

  • --includeThread=value

    Include records with specified thread ID. Values must be in hexadecimal (for example, --includeThread=2a).

  • --includeExtension=name=value[,name=value]*

    Include records with specified extension name and value. The value can include * or ? as a wildcard. To include a comma in the value, you must use "\,"

  • --includeInstance=value

    Include records from the specified server instance. Value must either be "latest" or be a valid instance ID. Run this command by using the listInstances action to see a list of valid instance IDs.

listInstances
List the IDs of server instances in the repository. A server instance is the collection of all log/trace records written from the time a server is started until it is stopped. Server instance IDs can be used with the --includeInstance option of the binaryLog view action.
The command syntax is as follows:
binaryLog listInstances {serverName | repositoryPath} [options]
serverName

Specify the name of a Liberty server with a repository to read from.

repositoryPath

Specify the path to a repository to read from. This path is typically the directory that contains the log data and trace data directories.

Note: Specify on the command line a value for serverName and a value for repositoryPath. Otherwise, the task runs against the default server instance, defaultServer, if it exists.
Output option:
  • --isoDateFormat

    Specifies that the ISO-8601 date and time format is used for output.

Be aware of binaryLog filtering optimizations. The binaryLog tool is able to filter log and trace data most efficiently when used with the following filter options:
  • --minDate
  • --maxDate
  • --includeThread
  • --minLevel
  • --maxLevel
Example usage

See the following examples of binaryLog commands.

  • Display all events in the defaultServer repository between 19 July 2013 and 2 August 2013.
    binaryLog view --minDate=07/19/13 --maxDate=08/02/13 
  • Display new events from server myServer, whose specified level is WARNING or higher, using the advanced format as the server writes them to the log repository.
    binaryLog view myServer --monitor --minLevel=WARNING --format=advanced 
  • Write log messages from a repository at /apps/server1/logs; include only those log messages that were written to the error stream of a specific repository.
    binaryLog view /apps/server1/logs --includeLogger=SystemErr 
  • View events from the defaultServer repository that occurred before 14 September 2012 4:28 PM eastern daylight time.
    binaryLog view --maxDate="09/14/12 16:28:00:000 EDT" 
  • Write events from the defaultServer repository that contain a 'thread' extension with value 'Default Executor-thread-4'
    binaryLog view --includeExtension=thread="Default Executor-thread-4" --format=advanced 
  • View the list of server instances in the defaultServer repository:
    binaryLog listInstances 
    
    Using D:\wlp\usr\servers\defaultServer\logs as repository directory.
    
    Instance ID                  Start Date
    1358809441761                1/21/13 18:04:01:761 EST
    1358864476191                1/22/13 9:21:16:191 EST
    1358869523192                1/22/13 10:45:23:192 EST
    1358871281166                1/22/13 11:14:41:166 EST
    1358879829000                1/22/13 13:37:09:000 EST
    1358892222067                1/22/13 17:03:42:067 EST
  • View events from the defaultServer by using one of the instance IDs from the previous example:
    binaryLog view --includeInstance=1358871281166
  • Copy events from the defaultServer, whose specified level is WARNING or higher, from the most recent server instance to a new repository at d:\toSupport directory.
    binaryLog copy defaultServer d:\toSupport --minLevel=warning --includeInstance=latest
  • View the time and date in the ISO-8601 format for the defaultServer repository by issuing the following command:
    binaryLog view --isoDateFormat
    The output is as follows:
    [2017-01-16T23:36:43.891-0500] 00000150 servlet I com.ibm.ws.webcontainer.servlet.ServletWrapper doDestroy SRVE0253I:
      [hello-world] [/hello-world] [/index.jsp]: Destroy successful.
    [2017-01-16T23:36:43.900-0500] 00000150 AppMessageHel A   CWWKZ0009I: The application hello-world has stopped successfully.
  • List the IDs of server instances in the repository in ISO-8601 format by entering the following command:
    listInstances --isoDateFormat
    The output is as follows:
    Instance ID                 Start Date
    1484625121871               2017-01-16T22:52:01.871-0500
    1484626095175               2017-01-16T23:08:15.175-0500