All of these suggestions are great. I will have to study them to determine the best general answer.
As I mentioned, the script is dealing with all sorts of events streaming from our thousands of devices. New devices in particular stream in SNMP that may not be patterned like the rest of the inputs.
I have to study the input more to determine how best to sanitize/normalize/ensure that all the required fields are present with expected values, etc.
I really appreciate all your help!
Thank you and have a wonderful day.