This is untested and might need some tweaking, but it should point you in the 
right direction:

require "string"

function process_message()
    local msg = decode_message(read_message("raw"))
    for _, field in ipairs(msg.Fields) do
        field.name = string.gsub(field.name, "%.", "_")
    end
    inject_message(msg)
end

Note that the "Type" value in the output message will have `heka.sandbox.` 
prepended, so by default the Type would become `heka.sandbox.heka.statmetric`.

Hope this helps.

-r


On 01/22/2016 05:45 AM, Klaus Post wrote:
Hi!


I am trying to put up a proof of concept where I work, to convince them
to use heka.

However, I have hit a small snag. For our limited scale test, we use
Elasticsearch for storing our data. However, ES 2.0 has added a
limitation, that you are not allowed to use dots (.) in field names.

This gives me an issue, since the "StatsAccumInput" filter outputs
fields with dots. I would like it to be in fields for use with Kibana.

I have added a local "fix" in my Heka server to the Encocer, where I
replace all dots in the field names. However, a more easily deployable
solution would be, if I could simply have a Lua Filter that did this for me.

My Lua skills unfortunately aren't as good as my Go skills. My thought
was that this might be a trivial task for someone out there.

You would help me a *lot*, if you could give me a base filter that
outputs the same messages as it gets, but replaces all "." in field
names with something else, like "-".


I hope you will be able to help me!


Regards, Klaus Post

http://www.klauspost.com


_______________________________________________
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