Deleting data snapshot files using the command line

You can determine the current disk space capacity and delete data snapshot files using the wsadmin command.

Before you begin

For a description of application-specific cross-component trace, see Cross-component trace overview.

About this task

The data files generated as a result of enabling cross-component trace with data snapshot, have a one-to-one relationship with the data added to the systemout.log and trace.log files. When WebSphere Application Server deletes old systemout.log and trace.log files, the result is orphaned data snapshot files that need to be deleted.

This task describes how to use the wsadmin command to retrieve the current disk usage and to delete data snapshot files from the logs\XCT directory. There is administrative console-equivalent to this command.

Deleting data snapshot files using the command line, or from the administrative console is a more preferable method than deleting the data snapshot files manually. However, the recommended method for deleting data snapshot shot files is to configure an automated data snapshot file cleanup from the administrative console.

Deleting data snapshot files using the command line deletes the XCT logs for a server. If there are multiple servers, run this command for each of the servers.
Note: In a network deployment environment with multiple nodes and servers defined on one machine, data snapshot files are written to a server-specific subdirectory. This allows you to identify, and delete the data snapshot files associated with each server.

Procedure

  1. To determine the current disk space usage, perform the following steps
    1. Open a command window.

      The wsadmin command can be found at the <WPS>/profiles/<dmgr profile>/bin directory or the <WPS>>/bin directory.

    2. At the command prompt, enter the wsadmin command to enter the wsadmin environment.
    3. Query the Cross-component trace Resources MBean
      set xctBean [$AdminControl queryNames *:*,type=XCTResourcesMBean]
    4. Call the getSnapshotSize command on the MBean
      $AdminControl invoke $xctBean getSnapshotSize
  2. To clear disk space usage, perform the following steps:
    1. Open a command window.

      The wsadmin command can be found at the <WPS>/profiles/<dmgr profile>/bin directory or the <WPS>>/bin directory.

    2. At the command prompt, enter the wsadmin command to enter the wsadmin environment.
    3. Query the Cross-component trace Resources MBean
      set xctBean [$AdminControl queryNames *:*,type=XCTResourcesMBean]
    4. Invoke the clearSnapshot command on the MBean:
      $AdminControl invoke $xctBean clearSnapshot

Example

This example illustrates how to use a wsadmin command to delete data snapshot files from the logs\XCT directory.
Note: If you are running the admin client from the deployment manager bin folder, you do not need to include the -host and -port parameters in the command.
wsadmin -connType SOAP -host myDmgr -port 8879 -user dmgradmin -password dmgrpass
> set xctBean [$AdminControl queryNames *:*,type=XCTResourcesMBean] 
> $AdminControl invoke $xctBean clearSnapshot 
This example illustrates how to use a wsadmin command to determine the current disk space usage:
wsadmin -connType SOAP -host myDmgr -port 8879 -user dmgradmin -password dmgrpass
> set xctBean [$AdminControl queryNames *:*,type=XCTResourcesMBean] 
> $AdminControl invoke $xctBean getSnapshotSize