DX Unified Infrastructure Management

  • 1.  How to call name of file to monitor with Logmon

    Posted Aug 10, 2017 05:09 PM
      |   view attached

    Hi everyone.

     

    Environment:

    CAUIM 8.51

    Logmon 3.90

     

    Situation:

    I have a file that I need monitoring with logmon, this file are in a directory that contains all files that is created each 24 hours and the file only change in the numer that is the date (day and month)

     

     

    I am using regulary expression to call the file, like this:

     

    [E][m][s][p][e][r][u][s][e]1*08.txt ----> this name corresponds to today 10 August. Tomorrow this file be Emsperuse1108

     

    Question:
    ¿How to call name of file to monitor with logmon when has many files in the same directory.?

     

    Please check the screenshot

     

    Anyone have some idea?

     

    ME



  • 2.  Re: How to call name of file to monitor with Logmon

    Posted Aug 10, 2017 06:26 PM

    In perl the call of the file is: $filename = sprint("\\Emsperuse%02d%02d1\.txt",$day,$month+1);

     

    How can I call this file with regular expression for logmon probe?



  • 3.  Re: How to call name of file to monitor with Logmon

    Broadcom Employee
    Posted Aug 11, 2017 10:14 AM

    Hello,

     

    You can use the time formatting primitives for the logmon probe, which are documented here:

    https://docops.ca.com/ca-unified-infrastructure-management-probes/ga/en/alphabetical-probe-articles/logmon-log-monitoring/logmon-im-configuration/logmon-advanced-im-configuration#logmonAdvancedIMConfiguration-UseTimeFormattingPrimitives

     

    So, for example, specifying this for the File (example is from a Linux system):

    /opt/Emsperuse%d%m.txt

     

    Will look for the following file:

    Aug 11 09:57:52:512 [139670697719552] logmon: Filename = /opt/Emsperuse1108.txt

     

    Specifying this:

    /opt/Emsperuse%m%d.txt

     

    will look for the following file (which does not exist):

    Aug 11 10:04:42:085 [139670697719552] logmon: Filename = /opt/Emsperuse0811.txt
    Aug 11 10:04:42:085 [139670697719552] logmon: fopen errno = 2
    Aug 11 10:04:42:085 [139670697719552] logmon: Unable to open /opt/Emsperuse0811.txt

     

    There are quite a few time formatting primitives available, which are documented, along with their expected behaviour on Windows/Linux.

     

    Regards

    Chandresh



  • 4.  Re: How to call name of file to monitor with Logmon

    Posted Aug 11, 2017 11:29 AM

    Thank you very mucho Chandresh_Patel for you answer. But I have other question.

     

    How can I configure this file name when the directory have many files like --->

     

    Emsperuse.0808tx

    Emsperuse0908.tx

    Emsperuse1008.tx

    Emsperuse1108.tx -----> This is the file for monitoring today.

     

    If I configuring the file name like Emsperuse%d%m.txt the configuiration is intelligent to understand that should to take the file which corresponds to today (Emsperuse1108.tx)  and skip the others?



  • 5.  Re: How to call name of file to monitor with Logmon

    Broadcom Employee
    Posted Aug 11, 2017 12:00 PM

    Hello,

     

    Yes, the other files would be ignored. The variables would be expanded first so that the target file looked for is Emsperuse1108.txt 

    In the example I showed earlier:

    Aug 11 09:57:52:512 [139670697719552] logmon: Filename = /opt/Emsperuse1108.txt

     

    I actually have a number of other files (e.g. Emsperuse1008.txt  etc.) in that same /opt directory but only the Emsperuse1108.txt was picked up.

     

    To test this and confirm for yourself, set the logmon loglevel sufficiently high (I had it set to 5 for testing). What you should see in the log is something like this:

     

    Aug 11 09:57:42:469 [139671702992704] logmon: expandStrftime: locale found[en_US.UTF-8]
    Aug 11 09:57:42:469 [139671702992704] logmon: fileFind - Directory: '/opt/' Pattern: 'Emsperuse1108.txt'
    Aug 11 09:57:42:469 [139671702992704] logmon: fileFind - getting file lock
    Aug 11 09:57:42:469 [139671702992704] logmon: fileFind - got file lock
    Aug 11 09:57:42:469 [139671702992704] logmon: fileFind - accept and save path '/opt/'
    Aug 11 09:57:42:469 [139671702992704] logmon: fileFind - Start file search
    Aug 11 09:57:42:469 [139671702992704] logmon: fileFind - save file with path '/opt/' and name 'Emsperuse1108.txt'
    Aug 11 09:57:42:470 [139671702992704] logmon: fileFind - Number of input files: 1 

     

    So although the directory contains a number of files that have the general name format of Emsperuseddmm.txt only the one that matches the fully expanded name is processed.

     

    Best Regards

    Chandresh



  • 6.  Re: How to call name of file to monitor with Logmon

    Posted Aug 15, 2017 03:59 PM

    Thank you I am monitoring the file okay