mozilla-services / heka

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

Heka exits before starting when using a SandboxFilter #1909

Open binman-docker opened 8 years ago

binman-docker commented 8 years ago

Attempting to add a sandbox filter to our configuration to drop some fields. When starting hekad, it does not finish loading (stops before outputs load) and exits with code 0.

This is what happens on startup:

user@host:/heka# hekad 2016/04/15 22:51:02 Pre-loading: [heka_tcp_input] 2016/04/15 22:51:02 Pre-loading: [DashboardOutput] 2016/04/15 22:51:02 Pre-loading: [GeoIpMultiDecoder] ... 2016/04/15 22:51:02 Loading: [ESJsonEncoder] 2016/04/15 22:51:02 Loading: [heka_tcp_input] 2016/04/15 22:51:02 Loading: [geoip_field_filter] user@host:/heka# echo $? 0 user@host:/heka#`

This is the config in hekad.toml (the rest of the config works fine with this block removed):

[geoip_field_filter] type = "SandboxFilter" message_matcher = "Fields[geoip] != NIL" filename = "/usr/local/share/heka/lua_filters/geoip_field_filter.lua" preserve_data = false

And this is geoip_field_filter.lua:

function process_message() local msg = decode_message(read_message("raw")) if msg.Fields["geoip"] ~= nil then msg.Fields["geoip"]["areacode"] = nil msg.Fields["geoip"]["charset"] = nil msg.Fields["geoip"]["continentcode"] = nil msg.Fields["geoip"]["coordinates"] = nil msg.Fields["geoip"]["countrycode"] = nil msg.Fields["geoip"]["countrycode3"] = nil msg.Fields["geoip"]["latitude"] = nil msg.Fields["geoip"]["longitude"] = nil msg.Fields["geoip"]["postalcode"] = nil if not pcall(inject_message, msg) then return -1 end end return 0 end

Strace says it never even looked at the lua file:

user@host:/heka# strace hekad ... write(1, "2016/04/15 22:55:24 Loading: [ge"..., 502016/04/15 22:55:24 Loading: [geoip_field_filter] ) = 50 stat("/var/cache/hekad/sandbox_preservation", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 exit_group(0) = ? +++ exited with 0 +++ user@host:/heka#

So it doesn't seem like the issue is with the lua code. Any ideas? I'm sure I'm missing something obvious. Permissions on /var/cache/hekad/sandbox_preservation are 755 owned by heka but it's set to preserve_data=false so that shouldn't matter anyway.

awl commented 7 years ago

Did you ever resolve this? I'm running into the exact same problem trying to load a filter I wrote.

binman-docker commented 7 years ago

No, unfortunately. We decided to move to Logstash since Heka is end-of-life and Logstash has a lot more built-in filters (including what I was trying to do with this custom lua filter) anyway.