I've included something like this before in my lua code using pcall.
It injects a new payload with the error or logs to stdout(commented out).
Uncomment return value to either exit or continue on depending on your
preference.

                local ok, err = pcall(inject_message, msg)
                if not ok then
                    inject_payload("txt", "debug", string.format("#line:%d,
error:%s", #line, err))
                    --error(string.format("#line:%d, error:%s, line:%s",
#line, err, line))
                    --return -1
                    return 0
                end


On Tue, Aug 9, 2016 at 10:00 AM, Wayne Walker <[email protected]>
wrote:

> I'm having trouble with a steup not complaining, but reading the entire
> input file without outputting anything.
>
> I need to add some logging.  I think somehow the grammar in the lua
> sandbox is failing.  How, in lua sandbox code, do I send a message to
> stdout or stderr?  Probably I need to generate a new message which will
> then be pickec up by an outputter like:
>
> [debug]
>   message_match = 'Type == "wayne_debug"'
>   ...
>
> But I don't know what to put in the lua.
>
> --
> Wayne Walker
>
> “For me, I am driven by two main philosophies: know more today about
> the world than I knew yesterday and lessen the suffering of others. You'd
> be surprised how far that gets you.”
> ― Neil deGrasse Tyson
> _______________________________________________
> Heka mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/heka
>
_______________________________________________
Heka mailing list
[email protected]
https://mail.mozilla.org/listinfo/heka

Reply via email to