Ad Widget

Collapse

how to write a numeric trigger on a log item ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tconway
    Junior Member
    • Apr 2017
    • 2

    #1

    how to write a numeric trigger on a log item ?

    From 2.4 (the release I am on) forwards, the doc for log items givesthis example for a Item monitoring a log for a numeric value ...

    log[/path/to/the/file,"large result buffer allocation.*Entries: ([0-9]+)",,,,\1]

    and claims:

    with the ability to extract and return a number, the value can be used to define triggers.

    But trying to define a trigger using this Item will not allow me to use any numeric functions

    {my-host:log[/opt/myCompany/myApp/log/app.log,"APP Rest-Api STATS: \/events ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)",,,,\4].max(300)}<1000

    This trigger expression fails with:

    Cannot implode expression
    Incorrect item value type "Log" provided for trigger function "max(300)"

    how can I do math with the numerical values extracted from the log ?
  • tconway
    Junior Member
    • Apr 2017
    • 2

    #2
    reply to myself with a better question

    Ok, so it seems all a log item can do is record text, even if it is actually a number that has been extracted.

    Is there any way to write a trigger script such that it can take that log item's text and then write a (new) numerical item back to the database for another trigger to use ?

    Comment

    Working...