首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ELK学习笔记之ELK分析syslog日志

ELK学习笔记之ELK分析syslog日志

作者头像
Jetpropelledsnake21
发布2018-12-05 15:09:10
3.2K0
发布2018-12-05 15:09:10
举报
文章被收录于专栏:JetpropelledSnakeJetpropelledSnake

0x00 配置FIlebeat搜集syslog并发送至

#配置
mv /etc/filebeat/filebeat.yml  /etc/filebeat/filebeat.yml.bak
vim /etc/filebeat/filebeat.yml
filebeat.prospectors:
- type: log
  enabled: true
  paths:
    - /var/log/messages
  fields:
    log_topics: syslog-1.202
  max_bytes: 1048576
 
output.logstash:
  hosts: ["127.0.0.1:5044"]
 
#启动
systemctl start filebea

0x01 配置Logstash从FIlebeat输入syslog日志并输出至Elasticsearch

#配置从beat 5044端口接收日志,且根据fields建立日志索引
vim /etc/logstash/conf.d/syslog.conf
input {
   beats {
    port => 5044
  }
}
 
output {
 if[fields][log_topics] == "syslog-1.202" {
  elasticsearch {
    hosts => ["192.168.1.202:9200"]
    index => "syslog-1.202-%{+YYYY.MM}"
  }
 }
}
 
#启动服务
systemctl start logstash

0x02 Troubleshooting

#日志排查
tailf /var/log/logstash/logstash-plain.log  
tailf /var/log/filebeat/filebeat   
 
#配置文件语法合规性排查
/usr/share/logstash/bin/logstash --path.settings /etc/logstash -f /etc/logstash/conf.d/syslog.conf --config.test_and_exit
/usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat.yml 

0x03 ElasticSearch查看索引

#查看索引
curl http://192.168.1.202:9200/_cat/indices?v  
health status index                uuid                   pri rep docs.count docs.deleted store.size pri.store.size
green  open   .kibana              sdsMVkoKQZaZncZf6OXEeg   1   0          1            0      3.7kb          3.7kb
yellow open   syslog-1.202-2018.03 0JDgsgabR16EozrEhVHosA   5   1          4            0     31.5kb         31.5kb
 
#清空无用索引
curl -XDELETE http://192.168.1.202:9200/+索引名

0x04 Kibana创建索引

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018-11-02 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 0x00 配置FIlebeat搜集syslog并发送至
  • 0x01 配置Logstash从FIlebeat输入syslog日志并输出至Elasticsearch
  • 0x02 Troubleshooting
  • 0x03 ElasticSearch查看索引
  • 0x04 Kibana创建索引
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档