Class: LogStash::Outputs::Exec
- Inherits:
-
Base
- Object
- Base
- LogStash::Outputs::Exec
- Defined in:
- lib/logstash/outputs/exec.rb
Overview
This output will run a command for any matching event.
Example:
output {
exec {
type => abuse
command => "iptables -A INPUT -s %{clientip} -j DROP"
}
}
Run subprocesses via system ruby function
WARNING: if you want it non-blocking you should use & or dtach or other such techniques
Instance Method Summary collapse
Instance Method Details
#receive(event) ⇒ Object
34 35 36 37 38 |
# File 'lib/logstash/outputs/exec.rb', line 34 def receive(event) return unless output?(event) @logger.debug("running exec command", :command => event.sprintf(@command)) system(event.sprintf(@command)) end |
#register ⇒ Object
29 30 31 |
# File 'lib/logstash/outputs/exec.rb', line 29 def register @logger.debug("exec output registered", :config => @config) end |