Centos6.5下 logstash5.2.2的安装 + log4j模式 (实践成功)

Centos6.5下 logstash5.2.2的安装 + log4j模式 (实践成功)

1、下载 logstash-5.2.2.tar.gz


2、解压
tar -zxvf logstash-5.2.2.tar.gz
cd logstash-5.2.2

3、修改 jvm heap 大小
/opt/logstash/logstash-5.2.2/config/jvm.options


4、创建log4j_to_es.conf,内容如下:

# For detail structure of this file
# Set: https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html
input {
  # For detail config for log4j as input,
  # See: https://www.elastic.co/guide/en/logstash/current/plugins-inputs-log4j.html
  log4j {
    mode => "server"
    host => "0.0.0.0"
    port => 4567
    type => "log4j"
  }
}
filter {
  #Only matched data are send to output.
  mutate{
    remove_field => "class"
    remove_field => "path"
    remove_field => "timestamp"
    remove_field => "@version"
  }
}
output {
  # For detail config for elasticsearch as output,
  # See: https://www.elastic.co/guide/en/logstash/current/plugins-outputs-elasticsearch.html
  elasticsearch {
    action => "index"                                                 #The operation on ES
    hosts  => "127.0.0.1:9200"                                   #ElasticSearch host, can be array.
    index  => "%{type}-%{+YYYY-MM-dd}"                #The index to write data to, can be any string.
  }
  stdout{
    codec => rubydebug{}
  }
}


5、后台启动运行
nohup ./logstash -f ../config/log4j_to_es.conf &
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值