You can use the error function from within process_message, but it won't have the same effect, it'll cause the filter to exit without generating any meaningful output. On the dev branch, it's possible for process_message to return an error code and an error message and the message will be written to stderr. If you're using a 0.8.x release, you'll want to inject a message with your output using inject_payload. If you do this from a SandboxFilter and you have a DashboardOutput set up, the output will show up in the dash. Otherwise you can set up a LogOutput to catch the messages and write to the console.
-r On 01/15/2015 09:58 AM, Djamel F. wrote:
Thanks for your help, it is very helpful for me. I would to know if I can do the same thing as error function in process_message ? Cordialement, --- Djamel FELLAH Tél : +33 6 26 68 57 09 Élève Ingénieur en Informatique École Université de Technologie de Belfort-Montbéliard On 14 January 2015 at 21:18, Rob Miller <[email protected] <mailto:[email protected]>> wrote: You can't write to stderr (or stdout) directly from a Lua sandbox, the very nature of "sandbox" is that we're limiting direct access to the underlying system. Instead, you have interact using APIs that Heka provides. In this case, you can achieve what you want with the error function, see https://github.com/mozilla-__services/heka/blob/dev/__sandbox/lua/filters/stat___graph.lua#L92 <https://github.com/mozilla-services/heka/blob/dev/sandbox/lua/filters/stat_graph.lua#L92>. -r On 01/14/2015 10:52 AM, djamel wrote: I want to write some message on *stderr* if I catch an error when my plugin starts (for example when config is invalid). I tried to use |io.stderr:write('message')|, in order to display a text message, but I couldn't import the |io|library. What is the recommended way to log error message from heka lua sandboxes ? _________________________________________________ Heka mailing list [email protected] <mailto:[email protected]> https://mail.mozilla.org/__listinfo/heka <https://mail.mozilla.org/listinfo/heka>
_______________________________________________ Heka mailing list [email protected] https://mail.mozilla.org/listinfo/heka

