Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter-codec idea #4383

Open
colinsurprenant opened this issue Dec 21, 2015 · 3 comments
Open

filter-codec idea #4383

colinsurprenant opened this issue Dec 21, 2015 · 3 comments
Labels

Comments

@colinsurprenant
Copy link
Contributor

@jsvd suggested some time ago to create a filter that could leverage codecs to do the filtering which would have the advantage of avoiding dual codec/filter implementations like the json codec and filter - we could have only the json codec and leverage the json codec into a filter-codec to create a json filter.

This issue is to keep a trace & followup on that idea.

Also, the same has been suggested for xml in logstash-plugins/logstash-filter-xml#22

@jsvd
Copy link
Member

jsvd commented Dec 22, 2015

my experiment with creating a logstash-filter-codec is in https://github.com/jsvd/logstash-filter-codec

@jsvd
Copy link
Member

jsvd commented Dec 28, 2015

more about the current functionality:

# decoding
% echo '{"test": "hey" }' | bin/logstash -e 'input { stdin {} } filter { codec { codec => json mode => decode } }  output { stdout { codec => rubydebug } }'
{
          "test" => "hey",
      "@version" => "1",
    "@timestamp" => "2015-12-28T13:45:37.344Z"
}

# encoding
% bin/logstash -e 'input { generator { count => 1 } } filter { codec { codec => json mode => encode } }  output { stdout { codec => rubydebug } }' 
{
       "message" => "{\"message\":\"Hello world!\",\"@version\":\"1\",\"@timestamp\":\"2015-12-28T13:46:14.657Z\",\"host\":\"Joaos-MBP.lan\",\"sequence\":0}",
      "@version" => "1",
    "@timestamp" => "2015-12-28T13:46:14.918Z"
}

@purbon
Copy link
Contributor

purbon commented Jan 8, 2016

I find this very interesting, we should enforce the idea of having code not duplicated and this could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants