Do you have feedback on our new interface?
Do you have feedback on our new interface? Let us know HERE
Visitor.. Karim Attia
Visitor..
634 views

Monitor a dynamic log file name via OMI policy

Hello ALl ,

How can i monitor a log file with a dynamic naming convention Filename_yyyymmdd.log that changes every day with OMI log file entry policy ?

0 Likes
4 Replies
Micro Focus Contributor
Micro Focus Contributor

Re: Monitor a dynamic log file name via OMI policy

Hi,

You may need a script to fetch the last modified file in the path and compare it with previous day file to see if both are same and continue the loop till you find the new file in the path.

Enclosed is a script for a similar requirement you may need to modify it as per your requirement.

Thanks,

Preetha Robert

0 Likes
Micro Focus Contributor
Micro Focus Contributor

Re: Monitor a dynamic log file name via OMI policy

This will need Measurement threshold policy and not log file policy.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Monitor a dynamic log file name via OMI policy

Hello Karim,

Per documentation, to make your policy more flexible in "Log File Path / Name" you can use:

•Script or command that returns the path and name of the log file you want to access. For example, type <`command`> where command is the name of a script that returns the path and name of the log file you want the policy to read.

The command can also return more than one log file path separated by spaces. OM Agent processes each of the files using the same options and conditions as configured for this policy. This is very useful when you want to dynamically determine the log file path or process multiple instances of a log file.

I just tested for a policy that monitors Windows node used:

      LOGPATH "<`dir E:\\MercuryDiag\\Server\\log\\status_changes.log*`>"

HTH\Tarif

 

FlexCare Services
Visitor.. Karim Attia
Visitor..

Re: Monitor a dynamic log file name via OMI policy

Hello ,

i used .bat script since its a windows node and the script echo the last modified file name succesfully

the script is :

@for /f %%a in ('dir /b/od D:\LogFiles\test*.log') do @SET file=%%a
@if "%file%" == "" exit /b 1
@echo D:\LogFiles\%file%

Now i need to take the script output as the file name / path , the script now is uploaded to the node need to be monitored , im using the preprocessing but it seems i do some thing wrong in putting the script in the policy to be executed in pre processing.

in addition in which format shall i put the log file path/ name , as it should take the script output , how can this happen ?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.