Examples: Running the BlackBerry Enterprise Service 10 Log Monitoring Tool

The last three steps in these examples simulate how a BlackBerry Device Service component writes new log events to a log file that is being monitored. These steps are not required in a production environment.

Example: Running the tool to create a separate file for each user account that contains the log messages for the user account

When the BlackBerry Enterprise Service 10 Log Monitoring Tool finds the specified text strings in the log.txt file, the tool creates files named jpalmer@test.rim.net.txt and karlatetzel@test.rim.net.txt.

  1. Create a file named cmd.bat that contains the following text:
    @echo off
    echo %LogMonitorText% >>%LogMonitorValue%.txt
    
  2. Create an input file named input.txt that contains the following string (regular expression) for the tool to monitor:
    ?:\} \{([^\}]*)
  3. Create a file named log.txt to store and append the log information.
  4. At the command prompt, run the following command:
    LogMonitor –L log.txt –input input.txt –action cmd.bat
  5. Create a text file named SampleMessage.txt.
  6. Copy the following lines to SampleMessages.txt:
    [40702] (08/16 00:00:11):{0x12E8} {jpalmer@rim.test.net} Starting message rescan
    [40703] (08/16 00:00:12):{0x12E8} {jpalmer@test.rim.net} Message rescan completed
    [40702] (08/16 00:00:12):{0x12E8} {karlatetzel@test.rim.net} Starting message rescan
    [40703] (08/16 00:00:12):{0x12E8} {karlatetzel@test.rim.net} Message rescan completed
    
  7. To append the contents of SampleMessages.txt to log.txt, at the command prompt, type type SampleMessages.txt >>log.txt.

Example: Running the tool so that when it finds events 40702 or 40703, it runs a cmd.bat file and closes

When the BlackBerry Enterprise Service 10 Log Monitoring Tool finds the log entries in the log.txt file, the BlackBerry Enterprise Service 10 Log Monitoring Tool completes the action in the cmd.bat file. For example, if cmd.bat is the same file that you used in the first example, the BlackBerry Enterprise Service 10 Log Monitoring Tool creates files named 40702.txt and 40703.txt.

  1. Create a file named cmd.bat.
  2. Create a text file named log.txt to store and append the log information.
  3. At the command prompt, run the following command:
    LogMonitor –L log.txt –events 40702,40703 –action cmd.bat
  4. Create a file named SampleMessage.txt.
  5. Copy the following log lines to SampleMessages.txt:
    [40702] (08/16 00:00:11):{0x12E8} {jpalmer@rim.test.net} Starting message rescan
    [40703] (08/16 00:00:12):{0x12E8} {jpalmer@rim.test.net} Message rescan completed
    [40702] (08/16 00:00:12):{0x12E8} {karlatetzel@test.rim.net} Starting message rescan
    [40703] (08/16 00:00:12):{0x12E8} {karlatetzel@test.rim.net} Message rescan completed
    
  6. To append the contents of SampleMessages.txt to log.txt, at the command prompt, type type SampleMessages.txt >>log.txt.


Was this information helpful? Send us your comments.