It is probably not the grammar failing, I am betting you return -1
somewhere else in the decoder.  Can you share the code?

Trink

On Wed, Oct 21, 2015 at 11:23 AM, Justin Vogt <justin.vog...@gmail.com>
wrote:

> Hello Heka Community,
>
> I’m getting a weird error… I’ve written a custom decoder in Lua, and it
> works find when I test it on the LPEG grammar tester, but when I try to run
> it in Heka, I continually get a “Decoder error, failed parsing” message.
> I’ve tried just about everything I can think of and have been pulling my
> hair out to figure out the issue. Any help would be greatly appreciated!!
>
>
> Here's the grammar
>
> local l = require "lpeg"
>
> local dt = require "date_time"
>
> local sp = l.space
>
> l.locale(l)
>
> local pri = l.P"<" * lpeg.Cg(lpeg.R"09"^0, "pri") * lpeg.P">"
>
> local logtime = l.Cg(dt.build_strftime_grammar("%b %d %X"), "logtime") * sp
>
> local hostname = l.Cg((1 - sp)^1, "hostname") * sp
>
> local logname = l.Cg((1 - sp)^1, "logname") * sp
>
> local message = l.Cg(l.P(1)^0, "message")
>
> msg = pri * logtime * hostname * logname * message
>
> grammar = l.Ct(msg)
>
>
> And a sample log line:
>
> <14>Oct 16 02:26:17 node-85 keystone-all 192.168.0.2 - - [16/Oct/2015
> 02:26:17] "GET /v3/auth/tokens HTTP/1.1" 200 10162 0.125928
>
>
> I can literally copy and paste the grammar out of the decoder and the log
> line from the failed parse message into the LPEG tester and it works.
>
>
> Thanks in advance!
>
> _______________________________________________
> Heka mailing list
> Heka@mozilla.org
> https://mail.mozilla.org/listinfo/heka
>
>
_______________________________________________
Heka mailing list
Heka@mozilla.org
https://mail.mozilla.org/listinfo/heka

Reply via email to