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

Add support for file path (as source) #36

Open
make opened this issue Feb 21, 2018 · 0 comments
Open

Add support for file path (as source) #36

make opened this issue Feb 21, 2018 · 0 comments

Comments

@make
Copy link

make commented Feb 21, 2018

I need to read static JSON from a file for each event. I use that JSON data in following ruby filter.

Current workaround is to use translate filter to read JSON encoded JSON and use json filter to decode it to JSON.
Current workaround:

echo '{"languages":"{\"1\":\"Afar\",\"2\":\"Afrikaans\",\"3\":\"Albanian\"}"}' > /opt/languages.json

logstash filter:

if [languages][id] {
    ruby {
      add_field => {
        "[@metadata][static][languages]" => "languages"
      }
    }

    translate {
      dictionary_path => "/opt/languages.json"
      field => "[@metadata][static][languages]"
      destination => "[@metadata][languagesJson]"
    }

    json {
      source => "[@metadata][languagesJson]"
      target => "[@metadata][languages]"
    }

    ruby {
      path => "/etc/logstash/scripts/handle-languages.rb"
    }
}

I would like it to be just:

echo '{"1":"Afar","2":"Afrikaans","3":"Albanian"}' > /opt/languages.json
if [languages][id] {
    json {
      path => "/opt/languages.json"
      target => "[@metadata][languages]"
    }

    ruby {
      path => "/etc/logstash/scripts/handle-languages.rb"
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant