In Syslog NG we need to regex the message texts to find the value of the deviceID and then use that in the log file name so that we can split the logs based on that value.
I've created a script, which executes but doesn't match and capture the deviceID value. I've tested and see $Common["VarCleanMessageText"] has the value I want and my regex works manually to capture, but in the script it doesn't match.
if ($Common["VarCleanMessageText"] -match $pattern) {
$Custom["deviceId"] = $matches[1]
} else {
# Set $Custom.deviceExternalId to "deviceId_not_found" if match not found
$Custom["deviceId"] = "deviceId_not_found"
}
The $Custom["deviceId] can be referenced when creating the filename, but it only contains the "deviceId_not_found" value that I manually set.
Thanks for any help/ideas on how to fix or debug.