how can I tell if a variable is defined.

Where this is tripping me up

On some of my relay boxes I set $!msg = $msg

on my central box I do a json parse and then I want to detect if there is a $!msg variable (some things are sending me data that has always been in JSON format, so $!msg was never set) and if there isn't a $!msg, I set $!msg = $msg so that anything that's trying to get traditionally formatted data will get the JSON instead of a blank line.

currently I'm testing for $!msg == '' but I do occasionally have some stuff that does output log messages with a blank body (for example, I do iostat 60 |logger -t iostat), so sometimes $!msg is defined, but is blank.

how do I tell the difference between these two conditions?

David Lang
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of 
sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE 
THAT.

Reply via email to