博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ELKStack-生产案例项目实战(十一)
阅读量:4508 次
发布时间:2019-06-08

本文共 2116 字,大约阅读时间需要 7 分钟。

ELKStack-生产案例项目实战

1、收集ES和apache日志,入redis

input {    file {        path => "/etc/httpd/logs/access_log"        start_position => "beginning"        type => "apache-accesslog"    }	file{        path => "/var/log/elasticsearch/myes.log"        type => "es-log"        start_position => "beginning"        codec => multiline{            pattern => "^\["            negate => true            what => "previous"        }    }}output{    if [type] == "es-log" {	    redis {            host => ["192.168.137.11"]            port => 6379            db => 1            data_type => "list"            key => "es-log"            timeout => 10        }    }    if [type] == "apache-accesslog" {        redis {            host => ["192.168.137.11"]            port => 6379            db => 1            data_type => "list"            key => "apache-accesslog"            timeout => 10        }    }}

启动/opt/logstash/bin/logstash -f /etc/logstash/conf.d/shipper.conf

2、通过syslog服务端主机,获取所有的客户端主机的syslog和redis中数据,写入ES

input{    syslog {        type => "system-syslog"        port => 514    }	redis {        type => "es-log"		host => ["192.168.137.11"]		port => 6379		db => 1		data_type => "list"		key => "es-log"		timeout => 10	}	redis {        type => "apache-accesslog"		host => ["192.168.137.11"]		port => 6379		db => 1		data_type => "list"		key => "apache-accesslog"		timeout => 10	}}filter {    if [type] == "apache-accesslog" {        grok {            match => { "message" => "%{COMBINEDAPACHELOG}" }        }    }}output{    if [type] == "apache-accesslog" {	    elasticsearch {            hosts => ["192.168.137.11:9200"]            index => "apache-accesslog-%{+YYYY.MM.dd}"        }    }    if [type] == "es-log" {        elasticsearch {            hosts => ["192.168.137.11:9200"]            index => "es-log-%{+YYYY.MM}"        }    }    if [type] == "system-syslog" {        elasticsearch {            hosts => ["192.168.137.11:9200"]            index => "system-syslog-%{+YYYY.MM}"        }    }}

启动/opt/logstash/bin/logstash -f /etc/logstash/conf.d/redis-es.conf

 

转载于:https://www.cnblogs.com/shhnwangjian/p/6261939.html

你可能感兴趣的文章
前端复习-01-dom操作包括ie和现代浏览器处理相关
查看>>
[CF612D] The Union of k-Segments(排序,扫描线)
查看>>
linux安装nginx
查看>>
spark书籍视频推荐
查看>>
django之富文本编辑器
查看>>
jsp第三章
查看>>
Android平台下利用zxing实现二维码开发
查看>>
【HTTP】Fiddler(三)- Fiddler命令行和HTTP断点调试
查看>>
镜像源归类
查看>>
IE下的document.onclick问题
查看>>
[模板]后缀数组
查看>>
git添加本地文件到github仓库
查看>>
0502《构建之法》第六、七章读后感
查看>>
[福大软工] Z班——Beta现场答辩反馈
查看>>
利用Pycharm本地调试spark-streaming(包含kafka和zookeeper等操作)
查看>>
Web控件
查看>>
状压DP泛做
查看>>
The New Stack:KubeEdge将Kubernetes的能力延伸至边缘
查看>>
Datatable的Select()
查看>>
Django之中间件
查看>>