Ad Widget

Collapse

Log file Prepocessing with Javascript error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #1

    Log file Prepocessing with Javascript error

    I'm monitoring a log file to capture a number from it.
    Basically, the line that I'm looking for is something like this:
    took 0 min(s) 29 sec(s) to sync after boot up
    I've created a log item and filtered it using a simple regular expression.
    Code:
    log["/tmp/mnt/entware/entware/var/log/messages","took (.*) to sync after boot up",,,skip,\1]
    There is a preprocessing step using Javascript.
    Code:
    var MIN = parseInt(value.match(/(\d+) min\(s\)/));
    var SEC = parseInt(value.match(/(\d+) sec\(s\)/));
    var TIME = (MIN * 60) + SEC;
    return TIME;
    Still, the item gets unsupported with the error message bellow
    Value "NaN" of type "string" is not suitable for value type "Numeric (unsigned)"
    As I understand it, the script should return an integer.
    I'm not sure why it is returning a string, though.
    Any thoughts?
Working...