DX Unified Infrastructure Management

  • 1.  Logmon question

    Posted Aug 04, 2011 09:49 PM

    Not sure if this is possible but, I need to watch for a line in a log file and at every poll interval QoS what number appears in the line.

     

    2011-07-12 07:42:34:233      12 File Rotation Needed

     

    (Wanting to QoS the 12 or whatever number it is from that line) Or is the something I pickup on the dashboard end and let the query pull the number from the line? I'm trying to end up with an historical graph.



  • 2.  Re: Logmon question

    Posted Aug 04, 2011 10:25 PM

    You should be able to pick that number out of the line with a regular expression capture. Regular expressions are a very good way to match lines in the logmon probe in general, and you can use parantheses to capture parts of the match into variables. When you configure the variable in the logmon watcher, you just specify which capture fills the variable (counting from the first set of parentheses starting at the left as 1). So something like this might work for a regex:

     

    / (\d+) File Rotation Needed/

     

    You can save the variable as QoS too. I just did something very similar to this recently, and I think it has been working well. (I should check it again now that it has been running a little while.)



  • 3.  Re: Logmon question

    Posted Aug 05, 2011 05:55 PM

    Got that working as far as sending the entire line in the alarm but, still haven't figured out how to send just that part of the line (27 File Rotation Needed) for the alarm mesage and then just the number vaule as the QoS data...

    Still dinking with it...



  • 4.  Re: Logmon question
    Best Answer

    Posted Aug 05, 2011 06:32 PM

    You should be able to make the alarm message say anything you want. The alarm message is defined directly under the match expression. If you assign the capture to a variable named num in the Variables tab, you could specify something like this for the alarm message:

     

    Need to rotate $num files

     

    After you have defined the variable, you should see it in the QoS tab and be able to enable it for QoS.



  • 5.  Re: Logmon question

    Posted Aug 05, 2011 06:45 PM
    Yep.. Thanks.. I got it... I guess I was making it harder than it was. Plus I was off one column.. lol


  • 6.  Re: Logmon question

    Posted Aug 05, 2011 06:48 PM

    Excellent!

     

    If you use the regex capture, you should not need to use the column number to extract the number from the string. The column method is fine when the position remains consistent (which should be the case here), but I just wanted you to know that the regex capture is an alternative to using the column number.