docker 运行logstash
官方文档https://www.elastic.co/guide/en/logstash/current/docker-config.html传统的配置文件方式通过配置logstash.yml文件的方式来启动logstashdocker run --rm -it -v ~/settings/logstash.yml:/usr/share/logstash/config/logs...
官方文档 https://www.elastic.co/guide/en/logstash/current/docker-config.html
传统的配置文件方式
通过配置logstash.yml文件的方式来启动logstash
docker run --rm -it -v ~/settings/logstash.yml:/usr/share/logstash/config/logstash.yml docker.elastic.co/logstash/logstash:6.6.0
这样就可以挂在启动logstash了
在宿主机用户目录下的settings目录下配置logstash.yml
例子配置:
input {
stdin {
}
jdbc {
# mysql jdbc connection string to our backup databse
jdbc_connection_string => "jdbc:mysql://192.168.0.49:3306/dfb"
# the user we wish to excute our statement as
jdbc_user => "test"
jdbc_password => "test"
# the path to our downloaded jdbc driver
jdbc_driver_library => "/opt/logstash/mysql-connector-java-5.1.36-bin.jar"
# the name of the driver class for mysql
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
statement_filepath => "jdbc.sql"
schedule => "* * * * *"
type => "jdbc"
}
}filter {
json {
source => "message"
remove_field => ["message"]
}
}output {
elasticsearch {
host => "192.168.0.199"
port => "9200"
protocol => "http"
index => "mysql01"
document_id => "%{id}"
cluster => "logstash-elasticsearch"
}
stdout {
codec => json_lines
}
}
更多推荐
所有评论(0)