TECHZEN Zenoss User Community ARCHIVE  

Wildcard in transform

Subject: Wildcard in transform
Author: [Not Specified]
Posted: 2014-11-28 02:17

I have traps that use the last digits as some kind of serial number and I need to have a wildcard in the transform.
i.e
evt.severity = getattr(evt, 'trap.83.1.1.1.5.12345')
How do I write the transform for catching evt.severity = getattr(evt, 'trap.83.1.1.1.5.*')

Anybody with some python skills



Subject: use .find method
Author: [Not Specified]
Posted: 2014-11-28 14:50

Are you trying to obtain the last number and use it or just match on the string leading up to the last serial number digit You can just "find" in whatever field you're looking at...

#search the message field of the evt for the given string
if evt.message.find("trap.83.1.1.1.5") >= 0:
evt._action = "drop"



< Previous
zenoss mail server on spamhaus blocklist
  Next
Zenoss Windows Integrated Login
>