mozilla-services / heka

DEPRECATED: Data collection and processing made easy.
http://hekad.readthedocs.org/
Other
3.4k stars 531 forks source link

How to debug a lua decoder? #1942

Closed ZhangYet closed 8 years ago

ZhangYet commented 8 years ago

I fount it my decoder will crash in production environment. It throw err msg as below:

2016/05/31 01:05:05 Decoder 'erulb_input-ErulbLogDecoder' error: FATAL: process_message() /usr/share/haruka/erulb_log.lua:6: output_limit exceeded

But it works well in my test envionment.

SO, is there any method to get information of my decoder while running in production environment? I mean since io is disabled in decoder/encoder etc, I can't use io to gather infomation from my decoder.

simonpasquier commented 8 years ago

If you're just asking questions, please don't use GitHub issues but the Heka mailing list.

If you catch exceptions in your decoder, you can inject the exception message in the Heka pipeline and send it wherever you want:

local ok, msg = pcall(inject_message, ...)
if not ok then
  inject_payload("txt", "error", msg)
end
ZhangYet commented 8 years ago

Sorry for my bad habit. And this solves my problem. Thanks a lot