logmon probe - monitor dynamically changing file name that includes a random PID
search cancel

logmon probe - monitor dynamically changing file name that includes a random PID

book

Article ID: 414834

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM) CA Unified Infrastructure Management On-Premise (Nimsoft / UIM) CA Unified Infrastructure Management SaaS (Nimsoft / UIM)

Issue/Introduction

We need to monitor a dynamically or randomly named file for a specific log entry or message. The issue we are running into is the dynamic name.  Instead of a name like application_message.txt, it is application_message_#####.txt where the number represents the PID of the service each time it is restarted. We need a way to interrogate a dynamically named logfile.

Environment

  • DX UIM 23.4 CU2
  • logmon 4.22, 5.02

Cause

  • How to use logmon to monitor a dynamically changing file name that contains an ever-changing PID

Resolution

We recommend using wildcards in the file path for a dynamically changing file name. For example, C:\path\to\file\application_message_*.txt

Note that you may not be able to use logmon to 'Browse' the file due to the wildcard.

If you manually change the file name/PID in the folder each time you want to test it, it should work during a normal run and generate your desired alarm, etc. You can check the logmon.log during the test run.

Use 'cat' mode to test the logmon profile and then 'updates' when letting the logmon profile run on its interval.

 

To test it out, change the random PID in the filename extension application_message_#####, each time you want to test the results.

Enter a /string/ for the match expression inside the logfile to parse - when testing it doesn't matter what you include in the logfile to test it as you just want to be able to monitor the changing file name and successfully parse the logfile contents.