DX Infrastructure Manager

Expand all | Collapse all

Save single line from log as a variable

Jump to Best Answer
  • 1.  Save single line from log as a variable

    Posted 08-30-2012 05:42 PM

    I am using the logmon probe and I am trying to save the line from the logfile that normally appears in the message of the alarm in to a variable, so that way I can do something like this in the "Messesage to send to send on match" field under the Watcher Rules tab: 

    Error occurred in Import Engine service : $message_from_logs



  • 2.  Re: Save single line from log as a variable
    Best Answer

    Posted 08-30-2012 05:46 PM

    Hi, you should just have to create a variable called $message_from_logs. Set the "From" location to Character position 1 and the "To" position to End of Line. You can then reference that variable in the alarm message.



  • 3.  Re: Save single line from log as a variable

    Posted 08-30-2012 05:56 PM

    You might also like to check the post from today in the guides section, its a new section and I hope you can see it.

     

    This explains how to use regex to capture groups for use as variables:

     

    "Alarm Message: I can group message text with (regex) to (create) groups"

     

    Within logmon you can then setup variables such as $1 and $mytext

     

    $1 = regex

    $mytext = create

     

    Its all in the guide :smileyhappy: