[syslog-ng] pattern matching on xxx#

Bill Anderson Bill.Anderson at bodybuilding.com
Fri Oct 15 20:48:14 CEST 2010


I have hostnames of the format xxxx# such as host1, hostb1, hostc1. I need to split that into two fields such as (host,1).

Unfortunately, since @@ escapes the @ and STRING and it's followers ALSO match digits, I've not found the obvious means to get that out. Conceptually something like @LETTER:host.name@@NUMBER:host.id@ woudl do it, save that LETTER doesn't exist and @@ escapes.

The end goal is as follows (pseudo-code):
I need to have a destination for each (HOST). For example all files from hosta## go to /var/log/hosta/ and entries for hostb## go to /var/log/hostb/

I suppose I *might* be able to do a rewrite to add say, a hyphen, and then use csv-parser, but we're talking some heavy traffic and I suspect that doing rewrites on that much traffic would be a performance killer.

I'm open to suggestions (that don't involve changing server names, preferably ;) ) as to how to accomplish this.

Cheers,
Bill


More information about the syslog-ng mailing list