logstach安装笔记

https://www.elastic.co/guide/en/logstash/current/index.html
首先下载logstash,上传到服务器

logstash是用JRuby语言开发的,所以要安装JDK

解压:
tar -zxvf logstash-2.3.1.tar.gz -C /bigdata/

启动:
bin/logstash -e 'input { stdin {} } output { stdout{} }'
bin/logstash -e 'input { stdin {} } output { stdout{codec => rubydebug} }'
bin/logstash -e 'input { stdin {} } output { elasticsearch {hosts => ["192.168.88.81:9200"]} stdout{} }'
bin/logstash -e 'input { stdin {} } output { elasticsearch {hosts => ["192.168.88.81:9200", "192.168.88.82:9200"]} stdout{} }'

bin/logstash -e 'input { stdin {} } output { kafka { topic_id => "test1" bootstrap_servers => "192.168.88.81:9092,192.168.88.82:9092,192.168.88.83:9092"} stdout{codec => rubydebug} }'

============================================================================================

以配置的形式:

vi logstash-kafka.conf

input {
  file {
    path => "/root/data/test.log"
    discover_interval => 5
    start_position => "beginning"
  }
}

output {
    kafka {
      topic_id => "test1"
      codec => plain {
        format => "%{message}"
        charset => "UTF-8"
      }
      bootstrap_servers => "node01:9092,node02:9092,node03:9092"
    }
}

#启动logstash
bin/logstash -f logstash-kafka.conf

------------------------------------------------

vi logstash-es.conf

input {
    file {
        type => "gamelog"
        path => "/log/*/*.log"
        discover_interval => 10
        start_position => "beginning" 
    }
}

output {
    elasticsearch {
        index => "gamelog-%{+YYYY.MM.dd}"
        hosts => ["node01:9200", "node02:9200", "node03:9200"]
    }
}

#启动logstash
bin/logstash -f logstash.conf


bin/logstash -e '
input { stdin {} }
filter {
  grok {
    match => { "message" => "%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}" }
  }

output { stdout{codec => rubydebug} 
}'

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值