首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >window下通过ELK框架进行大型日志线下的可视化分析

window下通过ELK框架进行大型日志线下的可视化分析

作者头像
MickyInvQ
发布2020-09-27 17:34:52
3480
发布2020-09-27 17:34:52
举报
文章被收录于专栏:InvQ的专栏InvQ的专栏

window下通过ELK框架进行大型日志线下的可视化分析

###1.ELK简介

  • E 就是Elasticsearch,分布式的、Restful风格的搜索和分析的搜索服务器
  • L 就是Logstash,吸收、转化、丰富、最后输出的完全开源的工具
  • K 就是Kibana,让分析结果数据可视化的框架前端开源展示工具

###2.工作流程 这里我们还采用了一个与logstash配合的小插件,filebeat,可通过连接点过去了解下,可以动态监测日志文件的变化。 所以整个过程是

  • 1.filebeat 对日志文件监测,然后作为日志源
  • 2.整合filebeat和logstash,logstash中有一个过滤器,将日志源进行过滤,将过滤结果输送给elastsearch服务器进行文
  • 3.整合kibana,通过前端配置筛选、然后在elasticsearch中进行搜索并返回结果给前端。

###3.关键配置及整合配置文件

  • 1.filebeat的日志源配置filebeat.yml
#=========================== Filebeat prospectors =============================

filebeat.prospectors:

# Each - is a prospector. Most options can be set at the prospector level, so
# you can use different prospectors for various configurations.
# Below are the prospector specific configurations.

- type: log

  # Change to true to enable this prospector configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
    #- /var/log/*.log
    - D:\ELK\sampleLog\*.log

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: true

  # Period on which files under path should be checked for changes
  #reload.period: 10s

#==================== Elasticsearch template setting ==========================

setup.template.settings:
  index.number_of_shards: 3
  #index.codec: best_compression
  #_source.enabled: false

#----------------------------- Logstash output --------------------------------
output.logstash:
  # The Logstash hosts
  hosts: ["localhost:5044"]
  • 2.logstash中的过滤器配置
input {
    beats {
        port => "5044"
    }
}
filter {
        grok {
                match => { 
                "message" => "%{COMBINEDAPACHELOG}"
                 "message1" => "(?<remoteUer>=[A-Z]+[0-9]+)
        (?<request>Begin\sRequest\[(\/[a-zA-Z]*)+\.do)
        (?<time>[0-9]+\/[0-9]+ [0-9]+:[0-9]+:[0-9]+)" }
    }
}
output {
        elasticsearch { 
            hosts => "localhost:9200"     
            index => "aa-%{+YYYY.MM.dd}" 
            document_type => "wjb_log" 
        }
}
  • 3.elasticsearch中elasticsearch.yml配置
cluster.name: elasticsearch
node.name: "lcc_node"
node.master: true
# 指定该节点是否存储索引数据,默认为true。
node.data: true
network.host: 127.0.0.1
http.port: 9200

http.cors.enabled: true
http.cors.allow-origin: "*"

# 单个命令来删除所有数据可能会导致可怕的后果。这个设置使删除只限于特定名称指向的数据, 而不允许通过指定 _all 或通配符来删除指定索引库。
action.destructive_requires_name: true
  • 3.依次启动服务 先启动elasticsearch,再启动logstash,再启动fileBeat,然后再次看logstash的日志输出,会发现filebeat的输入监听以及对elasticsearch的服务状态监测 通过在浏览器中输入如下路径观察elasticsearch服务,看到经典的 you know ,for search 说明启动成功 在浏览器中输入:http://localhost:5601/app/kibana 打开elasticsearch 页面
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-02-18 ,如有侵权请联系 cloudcommunity@tencent.com 删除

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

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

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

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • window下通过ELK框架进行大型日志线下的可视化分析
相关产品与服务
Elasticsearch Service
腾讯云 Elasticsearch Service(ES)是云端全托管海量数据检索分析服务,拥有高性能自研内核,集成X-Pack。ES 支持通过自治索引、存算分离、集群巡检等特性轻松管理集群,也支持免运维、自动弹性、按需使用的 Serverless 模式。使用 ES 您可以高效构建信息检索、日志分析、运维监控等服务,它独特的向量检索还可助您构建基于语义、图像的AI深度应用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档