Filebeat使用
文章内索引
[显示]
Filebeat使用方法:
1、下载最新的filebeat
地址:https://www.elastic.co/downloads/beats/filebeat 然后解压到需要采集日志的主机上
2、修改filebeat.yml文件
参考以下内容:
1 2 3 4 5 6 7 8 9 10 11 |
filebeat.prospectors: - input_type: log paths: - /usr/local/storm-0.9.5/logs/worker-*.log document_type: storm output.elasticsearch: hosts: ["192.168.29.120:9200"] template.enabled: true template.path: "filebeat.template.json" template.overwrite: true index: "filebeat-storm-%{+yyyy.MM.dd}" |
1 2 3 4 5 6 7 8 9 10 11 |
filebeat.prospectors: - input_type: log paths: - /home/web/*/Logs/Home/*.log document_type: php output.elasticsearch: hosts: ["192.168.29.120:9200"] template.enabled: true template.path: "filebeat.template.json" template.overwrite: true index: "filebeat-php-%{+yyyy.MM.dd}" |
里面hosts里的内容,改成实际elasticsearch的地址。
3、设置elasticsearch的filebeat模板
1 |
curl -XPUT 'http://localhost:9200/_template/filebeat?pretty' -d@/etc/filebeat/filebeat.template.json |
注:上面localhost:9200改成实际的elasticsearch的地址,后面的一串为filebeat根目录下的filebeat.template.json的完整路径,顺利的话,会返回:
1 2 3 |
{ "acknowledged" : true } |
表示模板已被接收。
4.启动
在日至采集机上执行
1 |
./filebeat -e -c filebeat.yml -d "Publish" |
如果能看到一堆东西输出,表示正在向elastic search发送日志。可以浏览:http://192.168.1.111:9200/_search?pretty 如果有新内容返回,表示ok
测试正常后,Ctrl+C结束,然后用
1 |
nohup ./filebeat -e -c filebeat.yml >/dev/null 2>&1 & |
5.在kibanna中创建索引
©版权声明:本文为【翰林小院】(huhanlin.com)原创文章,转载时请注明出处!
发表评论