Logstash configuration file to execute a command?

hey everyone,

i need to configure logstash to execute the output of the command "ifconfig" in elastic search then to visualize on kibana here is my logstash.conf file:

input {
exec {
command => "/sbin/ifconfig"

interval => 5 

}
}
output{
elasticsearch { hosts => ["elasticsearch:9200"] }
stdout { codec => rubydebug }

}
the error that i received fom the logs is attached below

can anyone help thanks in advance !

Are you by any chance running Logstash in a Docker container?

Next time, please don't post a screenshot. Use regular copy/paste from your terminal and post it as preformatted text (e.g. using the </> toolbar button).

yes i am

The Docker image you're using doesn't contain an /sbin/ifconfig binary. You might be able to mount it from your host system with the -v option to docker run, at least if you also make /proc available. A better option would be to build your own image based on the official image (which I think is CentOS-based) and install whatever package is needed for ifconfig.

thank you but i am using the command to run the docker :
docker run -h logstash --name logstash --link elasticsearch:elasticsearch -it --rm -v "$PWD":/config-dir logstash -f /config-dir/logstash1.conf

Yes...? docker run supports multiple -v options.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.