liblognorm icon indicating copy to clipboard operation
liblognorm copied to clipboard

liblognorm error: invalid field type 'string'

Open leyafo opened this issue 10 years ago • 6 comments

Hi,All. I'm using lognormalizer parse my nginx's access log. It has returned me this error when I parsed quote string.

My nginx's log text is: 255.255.255.255 - [email protected] [05/Nov/2015:15:15:56 +0800] "POST /url/foo/bar HTTP/1.0" 200 2 "-" "Jakarta Commons-HttpClient/3.0.1"

My rule file is: version=2 %ip:ipv4% - %user-email:word% [%time:word% %timezone:word%] %url:string%

leyafo avatar Nov 05 '15 08:11 leyafo

string is not a valid data type in liblognorm, word is probably what you want (a string of characters with no spaces in them), or you may want rest (everything from there to the end of the line)

What are you expecting to be in 'url' when you are done?

davidelang avatar Jan 28 '16 23:01 davidelang

If string is not a valid field type, it may be necessary to clarify something here: http://www.liblognorm.com/files/manual/configuration.html#string

aiwilliams avatar Apr 11 '16 14:04 aiwilliams

I think the problem was that the test was carried out with v1, while string is a v2 parser. It should now work, which we should verify to be sure. At the time of the original post, v2 was only available via experimental packages.

rgerhards avatar Jan 17 '17 11:01 rgerhards

@rgerhards , same problem with rsyslog8.26.1 with liblognorm5-2.0.3-1.el6.x86_64 installed. any suggestions, thanks !

logs: May 17 13:50:50 host_root rsyslogd: liblognorm error: rulebase file /etc/rsyslog.d/elastic_query.rb[19]: invalid field type '"string","name"' [v8.26.1 try http://www.rsyslog.com/e/2427 ]

sinsonglew avatar May 17 '17 06:05 sinsonglew

silly question, do you have version=2 as the first line in your .rb file?

davidelang avatar May 17 '17 06:05 davidelang

@davidelang, i do add version info at the top. it just doesn't work.

sinsonglew avatar May 17 '17 06:05 sinsonglew