当前位置: 移动技术网 > IT编程>开发语言>.net > .net core 与ELK(5)安装logstash

.net core 与ELK(5)安装logstash

2019年04月11日  | 移动技术网IT编程  | 我要评论

1.下载到/usr/local/src

wget https://download.elastic.co/logstash/logstash/logstash-2.4.0.tar.gz

2.解压

tar -zxvf logstash-2.4.0.tar.gz -c /usr/local

3.创建配置文件

cd /usr/local/logstash/config
vi test.conf

输入

input {
    file {
        path => "/opt/boot/logs/*.log"
        start_position => beginning
    }
    stdin {

    }
}
filter {
  #only matched data are send to output.
}
output {
    stdout {
      codec => rubydebug
    }
    elasticsearch {
    action => "index"          #the operation on es
    codec  => rubydebug
    hosts  => "192.168.235.32:9200"   #elasticsearch host, can be array.
    index  => "logstash-%{+yyyy.mm.dd}"         #the index to write data to.
  }
}

4.新建测试log文件

cd /opt/boot/logs
vim 1.log

写入测试数据:aa

5.打开kibana

新建index partner

查看

至此,简单完成了日志系统,生产中,可以通过serilog等组件写日志,通过logstash监听,并写入els,并展示出来

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网