logstash安装以及启动常用命令

安装:

去官网下载安装包解压即可。

测试:

基本的键盘输入并打印测试,一般用来测试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.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值