Page MenuHomeVyOS Platform

Syslog-identifier does not work in event handler
Closed, ResolvedPublicBUG

Description

When we use the option syslog-identifier in the event handler, it does not work.
For Example

service {
    event-handler {
        event INTERFACE_STATE {
            filter {
                pattern ".*eth0.*"
                syslog-identifier netplugd
            }
            script {
                path /config/scripts/eventhandler.py
            }
        }
    }
}

Messages that trigger this event handler.

Jun 30 13:57:42 vyos dhclient[10266]: DHCPREQUEST for 192.168.17.132 on eth0 to 255.255.255.255 port 67
Jun 30 13:57:42 vyos vyos-event-handler[15519]: Pattern found: ".*eth0.*", script executed: "/config/scripts/eventhandler.py"

The problem exists because of incorrect parsing of the configuration file. In the config file, syslog-identifier is written using a minus symbol, but the event-handler daemon tries to parse it with an underscore.

{
    "INTERFACE_STATE": {
        "filter": {
            "pattern": ".*eth0.*",
            "syslog_identifier": "netplugd"
        },
        "script": {
            "path": "/config/scripts/eventhandler.py"
        }
    }
}

Details

Difficulty level
Easy (less than an hour)
Version
vyos-1.4-rolling-202206300217
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Related Objects

StatusSubtypeAssignedTask
ResolvedFEATURE REQUESTdmbaturin
ResolvedBUGViacheslav