城市直播房产教育博客汽车
投稿投诉
汽车报价
买车新车
博客专栏
专题精品
教育留学
高考读书
房产家居
彩票视频
直播黑猫
投资微博
城市上海
政务旅游

结合springboot搭建日志采集系统EFK

9月21日 不将就投稿
  EFK架构(elasticsearchfilebeatkibana)
  1、filebeat采集日志(可以采集多种日志类型loghttpsystemcpmqdockeraws。。。,具体采集配置参照:https:www。elastic。coguideenbeatsfilebeatcurrentconfigurationfilebeatoptions。html)
  2、filebeat将采集到的日志解析推送至es
  3、kibana展示
  如果日志量特别大,可以参考此方案
  1、filebeat采集日志到kafka,利用kafka高并发处理能力,kafka也可以是集群
  2、logstash消费kafka数据,并存储到es集群,logstash也可以是集群
  当然可以选择其他方案,大型日志系统复杂性高,选择自己合适的日志解决方案
  本次部署版本为7。12。0,部署的时候确保版本一致。
  1、下载elasticsearch、kibana、filebeat
  〔rootecs7efk〕curlLOhttps:artifacts。elastic。codownloadselasticsearchelasticsearch7。12。0linuxx8664。tar。gz
  〔rootecs7efk〕curlLOhttps:artifacts。elastic。codownloadskibanakibana7。12。0linuxx8664。tar。gz
  〔rootecs7efk〕curlLOhttps:artifacts。elastic。codownloadsbeatsfilebeatfilebeat7。12。0linuxx8664。tar。gz
  2、创建用户并授权
  〔rootecs7efk〕groupaddelastic
  〔rootecs7efk〕useraddgelasticelasticsearch
  〔rootecs7efk〕chownRelasticsearch:elasticdataefk
  3、安装并启动
  3。1使用elasticsearch账号安装启动
  3。1。1解压elasticsearch
  〔rootecs7efk〕suelasticsearch
  〔elasticsearchecs7efk〕tarzxvfelasticsearch7。12。0linuxx8664。tar。gz
  3。1。2配置elasticsearch
  〔elasticsearchecs7efk〕cdelasticsearch7。12。0config
  备份原始配置文件
  〔elasticsearchecs7config〕cpelasticsearch。ymlelasticsearch。yml。org
  elasticsearch。yml全文(本次部署为单节点部署)
  集群名称
  cluster。name:testefk
  节点名称
  node。name:master
  索引数据存储目录
  path。data:dataefkelasticsearch7。12。0data
  日志
  path。logs:dataefkelasticsearch7。12。0dlogs
  外网访问
  network。host:0。0。0。0
  端口
  http。port:9200
  自动创建索引
  action。autocreateindex:。security,。monitoring,。watches,。triggeredwatches,。watcherhistory,appa,appb
  节点网络
  discovery。seedhosts:〔191。168。0。107〕
  当前节点类型
  cluster。initialmasternodes:〔master〕
  3。1。3启动elasticsearch
  〔elasticsearchecs7efk〕cdelasticsearch7。12。0bin
  〔elasticsearchecs7bin〕。elasticsearchd
  〔elasticsearchecs7bin〕ERROR:〔1〕bootstrapchecksfailed。Youmustaddressthepointsdescribedinthefollowing〔1〕linesbeforestartingElasticsearch。
  bootstrapcheckfailure〔1〕of〔1〕:maxvirtualmemoryareasvm。maxmapcount〔65530〕istoolow,increasetoatleast〔262144〕
  ERROR:Elasticsearchdidnotexitnormallycheckthelogsatdataefkelasticsearch7。12。0dlogstestefk。log
  启动es会有出现异常,解决方案,参照博客:https:blog。csdn。netF1004145107articledetails106279907
  3。1。4访问
  http:localhost:9200
  〔elasticsearchecs7bin〕curlhttp:localhost:9200
  {
  name:master,
  clustername:testefk,
  clusteruuid:Hovo67CRTF2zMnygQJ2NQ,
  version:{
  number:7。12。0,
  buildflavor:default,
  buildtype:tar,
  buildhash:78722783c38caa25a70982b5b042074cde5d3b3a,
  builddate:20210318T06:17:15。410153305Z,
  buildsnapshot:false,
  luceneversion:8。8。0,
  minimumwirecompatibilityversion:6。8。0,
  minimumindexcompatibilityversion:6。0。0beta1
  },
  tagline:YouKnow,forSearch
  }
  3。2安装启动kibana
  3。2。1解压kibana
  〔rootecs7efk〕suelasticsearch
  〔elasticsearchecs7efk〕tarzxvfkibana7。12。0linuxx8664。tar。gz
  3。2。2配置kibana
  〔elasticsearchecs7efk〕cdkibana7。12。0linuxx8664
  〔elasticsearchecs7kibana7。12。0linuxx8664〕cdconfig
  〔elasticsearchecs7config〕cpkibana。ymlkibana。yml。org
  备份原始配置文件
  〔elasticsearchecs7config〕cpkibana。ymlkibana。yml。org
  kibana。yml全文
  端口
  server。port:5601
  主机
  server。host:0。0。0。0
  名称
  server。name:master
  es集群地址
  elasticsearch。hosts:〔http:127。0。0。1:9200〕
  日志目录
  logging。dest:dataefkkibana7。12。0linuxx8664logskibana。log
  3。2。3启动kibana
  〔elasticsearchecs7kibana7。12。0linuxx8664〕ll
  total1476
  drwxrxrx2elasticsearchelastic4096Mar1813:56bin
  drwxrxrx2elasticsearchelastic4096Apr1309:53config
  drwxrxrx2elasticsearchelastic4096Apr711:26data
  rwrr1elasticsearchelastic3860Mar1813:55LICENSE。txt
  drwxrxrx2elasticsearchelastic4096Apr711:26logs
  drwxrxrx6elasticsearchelastic4096Mar1813:55node
  drwxrxrx831elasticsearchelastic36864Mar1813:55nodemodules
  rwrr1elasticsearchelastic1428396Mar1813:55NOTICE。txt
  rwrr1elasticsearchelastic740Mar1813:55package。json
  drwxrxrx2elasticsearchelastic4096Mar1813:55plugins
  rwrr1elasticsearchelastic3968Mar1813:55README。txt
  drwxrxrx12elasticsearchelastic4096Mar1813:55src
  drwxrxrx3elasticsearchelastic4096Mar1813:55xpack
  〔elasticsearchecs7kibana7。12。0linuxx8664〕cdbin
  〔elasticsearchecs7bin〕ll
  total16
  rwxrxrx1elasticsearchelastic850Mar1813:55kibana
  rwxrxrx1elasticsearchelastic783Mar1813:55kibanaencryptionkeys
  rwxrxrx1elasticsearchelastic776Mar1813:55kibanakeystore
  rwxrxrx1elasticsearchelastic813Mar1813:55kibanaplugin
  〔elasticsearchecs7bin〕。kibana
  3。2。4访问
  浏览器访问http:localhost:5601
  3。3安装启动filebeat
  filebeat不一定要跟es放在同一台服务器,可以是本机可以是其他服务器,它是一个采集工具,可以将数据推送至es,以下采用本机演示
  3。3。1解压配置filebeat
  备份原始配置文件
  filebeat。yml全文
  Filebeatinputs
  filebeat。inputs:
  type:log
  enabled:true
  encoding:UTF8
  Pathsthatshouldbecrawledandfetched。Globbasedpaths。
  paths:
  需要采集的日志文件
  D:data。log
  json。keyunderroot:true
  json。overwritekeys:true
  json。messagekey:message
  json。adderrorkey:true
  tags:〔saas〕
  Filebeatmodules
  filebeat。config。modules:
  Globpatternforconfigurationloading
  path:{path。config}modules。d。yml
  Settotruetoenableconfigreloading
  reload。enabled:false
  Periodonwhichfilesunderpathshouldbecheckedforchanges
  reload。period:10s
  Elasticsearchtemplatesetting
  setup。template。settings:
  index。numberofshards:1
  index。codec:bestcompression
  source。enabled:false
  setup。kibana:
  ElasticsearchOutput
  output。elasticsearch:
  Arrayofhoststoconnectto。
  es地址
  hosts:〔191。168。0。107:9200〕
  processors:
  addhostmetadata:
  when。not。contains。tags:forwarded
  addcloudmetadata:
  adddockermetadata:
  addkubernetesmetadata:
  日志时间处理
  timestamp:
  field:json。timestamp
  timezone:AsiaShanghai
  layouts:
  20060102T15:04:0508:00
  20060102T15:04:05。99908:00
  test:
  20190622T16:33:5108:00
  20191118T04:59:51。12308:00
  删除相关字段
  dropfields:
  fields:〔json。version,json。levelvalue,json。timestamp〕
  重命名字段
  rename:
  fields:
  from:json。logName
  to:json。appName
  ignoremissing:false
  failonerror:true
  3。3。3启动filebeat
  使用cmd运行filebeat。exe
  3。4springbootlogback配置
  pom。xml新增logstashlogbackencoder依赖,logstashlogbackencoder可以将日志以json的方式输出,也不用我们单独处理多行记录问题
  net。logstash。logback
  logstashlogbackencoderartifactId
  5。3
  dependency
  ?xmlversion1。0encodingUTF8?
  d{yyyyMMddHH:mm:ss。SSS}〔thread〕5levelloggermsgn
  UTF8
  encoder
  appender
  logs{logName}{logName}。log
  trueappend
  logs{logName}{logName}d{yyyyMMdd}。log。i
  64MB
  30hr1GB
  rollingPolicy
  AsiaShanghai
  timestamp
  {level:level,class:logger{40},message:message,stacktrace:exception}
  pattern
  providers
  encoder
  appender
投诉 评论 转载

周小川三不为数字人民币正名随着场景的逐步铺开和试点的不断深入,如今,数字人民币引发越来越多的讨论:究竟数字人民币如何实现可控匿名?是否会取代微信、支付宝等第三方支付?又将如何推动人民币国际化?率先落地哪……数字藏品(NFT)与加密货币数字货币对比数字藏品(NFTNonFungibleToken)定义:软件开发者在区块链系统上面根据一定公认的标准协议合约所发行的非同质化数字通证,其特性是独一无二、不可复制、不可分割具有专……Meta禁止俄罗斯官方媒体在Facebook等所有平台投放广IT之家2月26日消息,Facebook的母公司Meta宣布,在与乌克兰的冲突期间,禁止俄罗斯官方媒体在其所有平台上投放广告或赚钱。据Facebook安全政策负责人Nat……你们一般都在哪里找壁纸?我一般会在微博,有专门的微博号全部都是好看又可爱的壁纸。发几张我找的给你看看一般会在微博,有专门的微博号全部都是好看又可爱的壁纸。发几张我找的给你看看今日头条。今日……结合springboot搭建日志采集系统EFKEFK架构(elasticsearchfilebeatkibana)1、filebeat采集日志(可以采集多种日志类型loghttpsystemcpmqdockeraws……女子购买新能源车后发现电瓶竟然不属于自己,车行协议有规定买电瓶车,说实在的,我就是图便宜,晚上11点到早晨7点充电也就五六毛钱一度。陈大姐陈大姐是网约车司机,2021年6月份,四川成都陈大姐在龙泉驿区的优车库购买了一辆新……进入深水区,互联网企业干重活的时候到了近四成的GDP贡献数字经济何以成为百年变革中的经济新引擎?这要从技术革命史来看。拉开世界文明的时间轴,人类先后经历了农业革命、工业革命、信息革命。每一次产业技术革命……大公司早报抖音将提示外放音量过高淘宝及部分微信小程序接入云闪(整理胡毓靖)今天是9月30日星期四,过去24小时的大公司新闻包括:淘宝及部分微信小程序已支持云闪付付款;顺丰控股完成收购嘉里物流51。5股权;阿里申请多个元宇宙商标;抖……区块链工作在2021年激增400,是其他技术工作的4倍LinLinkedIn在其最新报告中表示,与比特币和区块链相关的职位发布在2021年的所有技术相关职位中增幅最大。随着区块链超越金融服务,该行业的角色和行业也出现了多样化。在最……新华社发布NFT释放了什么信号?12月22日新华社发文宣布将于12月24日20:00通过区块链NFT技术,发行限量藏品。该系列收藏品是中国首套新闻数字藏品,将精选的2021年新闻摄影报道进行铸造,记录了……小米MIX4全球首发骁龙888Plus,升级一指连来自知名爆料博主,数码闲聊站消息:小米MIX4将全球首发骁龙888Plus目前消息来看全新的小米MIX4将拥有众多黑科技,全新的UWB、无线充电刷新记录,屏占比惊人,打孔……美国服务器和香港服务器有啥区别?现在人们在选择服务器的时候总是有着共同人的特点,那就是选择困难症,是选择美国服务器好还是选择香港服务器好,其实选择哪个服务器还是要根据自己的情况来决定的,下面小编为大家介绍一下……
男女通杀?七夕最佳数码礼物预定,OPPOWatch2被年轻人坚果J10S好不好?只有真实体验才知道为什么互联网大厂一边大规模裁员一边招聘?王者荣耀安卓修改手机定位详细教程如何选择合适的机器人打磨工具早晚温差大,智能家居还你健康舒适全民健身兴起,来看看这些互联网出的运动新风尚iOS15爆料信息汇总,或将更新以下四个功能用户还车一周被通知车辆有剐蹭,GOFUN平台一年后竟自动扣款有线Carlife转无线Carplay一年使用体会真香奔驰再度加码固态电池辉能科技计划2022年底在欧洲建成新工厂天选姬稳站游戏本C位华硕天选2靠神仙颜值出圈
独有优势造就中国企业长达年的快速成长孕妇怀孕期间如何补充维生素2021年最新武器装备研制设计师系统和行政指挥系统工作条例热 蒸馒头为什么有硬心蒸馒头有硬心怎么办女人束腰危害大想要瘦腰这样做已领吊兰是兰花的一种吗施华蔻是哪个国家的品牌?施华蔻洗发水价格多少钱?某个朋友的微信聊天记录没了(微信某个人的聊天记录突然没有了)病毒溯源又有新发现,美国该如何解释?赵立坚再提调查美国实验室森林报读后感关晓彤25岁啦!穿高定裙拍生日写真大爆火,高调庆生秀恩爱太甜

友情链接:中准网聚热点快百科快传网快生活快软网快好知文好找江西南阳嘉兴昆明铜陵滨州广东西昌常德梅州兰州阳江运城金华广西萍乡大理重庆诸暨泉州安庆南充武汉辽宁