Edit the configuration file to configure logstash
vim /etc/logstash/conf.d/01-logstash.conf
input { stdin{} }
output {
elasticsearch{ hosts => ["192.168.56.11:9200"] }
stdout { code => rubydebug }
}
/opt/logstash/bin/logstash -f /etc/logstash/conf.d/01-logstash.conf
For a detailed explanation of the syntax of the logstash configuration file, please refer to the following. Common plugins also need to be queried on the official website :
https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html
Take the file plugin as an example to learn the configuration file syntax :
vim /etc/logstash/conf.d/file.conf
input {
file {
path => "/var/log/messages"
type => "system"
start_position => "beginning"
}
}
output {
elasticsearch {
hosts => ["192.168.56.11:9200"]
index => "system-%{+YYYY.MM.dd}"
}
}
/opt/logstash/bin/logstash -f /etc/logstash/conf.d/file.conf
![](https://images2018.cnblogs.com/blog/1370697/201804/1370697-20180424095157002-1261676716.jpg)
![](https://images2018.cnblogs.com/blog/1370697/201804/1370697-20180424095210342-736167726.jpg)