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

Event Decoration does not occur with path option, despite documentation saying it will #45

Closed
yaauie opened this issue Jul 18, 2018 · 0 comments · Fixed by #46
Closed
Assignees

Comments

@yaauie
Copy link
Contributor

yaauie commented Jul 18, 2018

In the path-based scripting mode, common filter decoration directives (e.g., add_field, add_tag) are not run on a successful execution of the ruby filter.

e.g., with the following ruby script:

def filter(event)
 logger.info("processing event")
 [event]
end

success.logstash-filter.rb

And the following pipeline config:

input {
  generator { count => 1 }
}
filter {
  ruby {
    path => "${PWD}/success.logstash-filter.rb"
    add_field => {"ruby" => "success"}
  }
}
output {
  stdout { codec => rubydebug }
}

pipeline.conf

The event succeeds, but is not decorated:

╭─{ yaauie@castrovel:~/src/elastic/discuss-scratch/140375-ruby-filter-error }
╰─○ logstash-6.3.0/bin/logstash -f pipeline.conf
Sending Logstash's logs to /Users/yaauie/src/elastic/discuss-scratch/140375-ruby-filter-error/logstash-6.3.0/logs which is now configured via log4j2.properties
[2018-07-18T18:34:19,521][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2018-07-18T18:34:20,093][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.3.0"}
[2018-07-18T18:34:22,191][INFO ][logstash.filters.ruby.script] Test run complete {:script_path=>"/Users/yaauie/src/elastic/discuss-scratch/140375-ruby-filter-error/success.logstash-filter.rb", :results=>{:passed=>0, :failed=>0, :errored=>0}}
[2018-07-18T18:34:23,234][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-07-18T18:34:23,325][INFO ][logstash.pipeline        ] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x739da9e8 run>"}
[2018-07-18T18:34:23,414][INFO ][logstash.agent           ] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2018-07-18T18:34:23,527][INFO ][logstash.filters.ruby.script.context] processing event
[2018-07-18T18:34:23,898][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
{
      "@version" => "1",
       "message" => "Hello world!",
    "@timestamp" => 2018-07-18T18:34:23.363Z,
          "host" => "castrovel.local",
      "sequence" => 0
}
[2018-07-18T18:34:23,948][INFO ][logstash.pipeline        ] Pipeline has terminated {:pipeline_id=>"main", :thread=>"#<Thread:0x739da9e8 run>"}
logstash-6.3.0/bin/logstash -f pipeline.conf  78.29s user 2.42s system 384% cpu 20.964 total
[success (21.000s)]
@jsvd jsvd self-assigned this Jul 30, 2018
jsvd added a commit to jsvd/logstash-filter-ruby that referenced this issue Aug 1, 2018
@jsvd jsvd closed this as completed in #46 Aug 1, 2018
jsvd added a commit that referenced this issue Aug 1, 2018
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

Successfully merging a pull request may close this issue.

2 participants