rsyslog / liblognorm

a fast samples-based log normalization library
http://www.liblognorm.com
GNU Lesser General Public License v2.1
99 stars 64 forks source link

Add support for user defined separator for name-value-list #322

Open preyniers opened 5 years ago

preyniers commented 5 years ago

The undocumented "named-value-list" should support a user defined separator. According to "parser.c", the only value supported is whitespace, which supports statements, such as:

foo=foo message bar=bar message

A user defined separator should be allow to support use cases where the value separator is other than whitespace (e.g. comma), such as:

foo=foo message,bar=bar message

An even more flexible scenario would allow for defining both key separator (nvlkey-sep) and value separator (nvlval-sep). This would allow for syntax, such as:

rule=example:%[ { "type" : "name-value-list", "name" : "foo", "nvlkey-sep" : ":", "nvlval-sep" : "," }, { "type" : "rest", "name" : "_unparsed" } ]%

Matching more advanced scenarios, such as:

foo:foo message,bar:bar message

--phil r.