logstash安装以及启动常用命令
安装:去官网下载安装包解压即可。测试:基本的键盘输入并打印测试,一般用来测试logstash是否可用.\bin\logstash.bat -e "input { stdin { } } output { stdout {} }"配置:配置.conf文件,一般包含字段为,stdin,filter,stdout,样例如下:input {#beats {#port => 5044#}file{ty
·
安装:
去官网下载安装包解压即可。
测试:
基本的键盘输入并打印测试,一般用来测试logstash是否可用
.\bin\logstash.bat -e "input { stdin { } } output { stdout {} }"
配置:
配置.conf文件,一般包含字段为,stdin,filter,stdout,样例如下:
input {
# beats {
# port => 5044
#}
file{
type => "messages"
path => ["/usr/local/elk/nmc_test.log"]#文件路径
start_position => "beginning"#读取位置为从头开始,默认为上次读到的位置
sincedb_path => "/dev/null"#上次读取的记录指向为空,若指向为某个文件,则下次启动会从上次的位置开始读取。
codec => json{
charset => "UTF-8"
}#解析json文件
}
}
filter{
}
output {
#elasticsearch {
# hosts => ["http://localhost:9200"]
# index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "changeme"
#}
stdout { codec => rubydebug }#
}
logstash.yml为logstash的参数配置。
启动:
bin/logstash -f first-pipeline.conf --config.test_and_exit
bin/logstash -f first-pipeline.conf --config.reload.automatic
The --config.test_and_exit
option parses your configuration file and reports any errors.
The --config.reload.automatic
option enables automatic config reloading so that you don’t have to stop and restart Logstash every time you modify the configuration file.
更多推荐
已为社区贡献1条内容
所有评论(0)