DX Unified Infrastructure Management

  • 1.  Getting LogMon to monitor log file with changing Folder Name

    Posted Jan 12, 2018 03:25 PM

    I need to monitor a file with Logmon.  The file directory changes for every instance.  The file being monitored in in Jenkins Software.  The directory structure is as follows

     

    c:\Software\Jenkins\home\Jobs\Project Name\builds\buildnumber\log

     

    Examples:

    c:\Software\Jenkins\home\Jobs\MyProject\builds\1341\log

    c:\Software\Jenkins\home\Jobs\MyProject\builds\1342\log

    c:\Software\Jenkins\home\Jobs\MyProject\builds\1343\log

     

    For each build run, a new Build folder is created.

     

    How can I get the logmon monitor to view the next build number log file after the build is successful.

     

    There is a file called nextBuildNumber in the following folder

    c:\Software\Jenkins\home\Jobs\MyProject\nextBuildNumber -  This will tell us what the next build number is. 

    Is there a way to get the logmon or another probe to change the file path, after it detects the NextBuildNumber?

     

     



  • 2.  Re: Getting LogMon to monitor log file with changing Folder Name
    Best Answer

    Posted Jan 15, 2018 08:26 AM

    You can use a sort of regex in the logmon probe. If your file is a fixed name, you can use a sort of regex (beware, two different kind of expressions might be used, wildcards or regexp, I invite you to have a look at the logmon probe documentation to see examples and how to use this) like : c:\Software\Jenkins\home\Jobs\MyProject\builds\*\log\myfile.log.



  • 3.  Re: Getting LogMon to monitor log file with changing Folder Name

    Posted Jan 26, 2018 02:56 PM

    Christophe,  Thank you for this valuable information,  The Wildcard example works like a charm for my environment. Kudos to you.

     

    Don



  • 4.  Re: Getting LogMon to monitor log file with changing Folder Name

    Posted Feb 02, 2018 10:02 AM

    Christophe,

       While the patch you suggested works, and scans the multiple log files, and produces the results, I am faced with an issues

    Jenkins builds create the log files based on the structure mentioned. After the build is complete, it creates a copy of the log file and places it in one of the following folders based on the status of the build

     

    c:\Software\Jenkins\home\Jobs\MyProject\builds\lastStableBuild

    c:\Software\Jenkins\home\Jobs\MyProject\builds\lastSuccessfulBuild

    c:\Software\Jenkins\home\Jobs\MyProject\builds\lastUnstableBuild

    c:\Software\Jenkins\home\Jobs\MyProject\builds\lastUnsuccessfulBuild

     

    I want to exclude these folders from the scan.

     

    Any thoughts using regexp for the File path to include all folders except the 4 folders above.  I'm not that experienced with regexp expressions.

     

    Any help would be greatly appreciated.

     

    Don



  • 5.  Re: Getting LogMon to monitor log file with changing Folder Name

    Posted Feb 02, 2018 10:48 AM

    Well, I would say you have this possibility: restrict your Regular Expression to catch only directories with numbers (from your first post, it seems all your building directories are 4 figure numbers). You could use something like [0-9]{4}, so, having a file regexp using this could work:

    c:\Software\Jenkins\home\Jobs\MyProject\builds\[0-9]{4}\log\myfile.log

    Though, I remember there are some limitations in the regexp we can use in the "directory" part (not sure anything else than '*' is supported, that was true some years ago, don't remember if that has changed on the last releases). Try it and let me know (if that doesn't work, I have other suggestions to try).



  • 6.  Re: Getting LogMon to monitor log file with changing Folder Name

    Posted Feb 02, 2018 01:53 PM

    Once again, you have come through with a great solution.  That worked like a charm.  I tested the path successfully.


    Thank you again for your help and your quick response.

    Don



  • 7.  Re: Getting LogMon to monitor log file with changing Folder Name

    Posted Feb 09, 2018 09:42 AM

    dhayes   moving this thread to the CA Unified Infrastructure Management community, please be sure to follow that community