加入收藏 | 设为首页 | 会员中心 | 我要投稿 惠州站长网 (https://www.0752zz.com.cn/)- 办公协同、云通信、物联设备、操作系统、高性能计算!
当前位置: 首页 > 建站 > 正文

你头疼的ELK难题,本文几乎都解决了

发布时间:2019-03-23 06:56:13 所属栏目:建站 来源:alonghub
导读:副标题#e# 一、ELK实用知识点总结 1、编码转换问题 这个问题,主要就是中文乱码。 input中的codec=plain转码: codec=plain{ charset=GB2312 } 将GB2312的文本编码,转为UTF-8的编码。 也可以在filebeat中实现编码的转换(推荐): filebeat.prospectors: -in

③5.5版本之前(after为例)

  1. filebeat.prospectors: 
  2. - input_type: log  
  3.      paths: 
  4.       - /root/performanceTrace* 
  5.       input_type: log  
  6.       multiline: 
  7.            pattern: '^20.*' 
  8.            negate: true 
  9.            match: after 

在logstash input中使用multiline插件(没有filebeat时推荐):

①介绍multiline

  • pattern:正则匹配从哪行合并;
  • negate:true/false,匹配到pattern 部分开始合并,还是不配到的合并。

what:previous/next(需自己理解)

  • previous:相当于filebeat 的after;
  • next:相当于filebeat 的before。

②用法

  1. input { 
  2.         file { 
  3.                 path => ["/root/logs/log2"] 
  4.                 start_position => "beginning" 
  5.                 codec => multiline { 
  6.                         pattern => "^20.*" 
  7.                         negate => true 
  8.                         what => "previous" 
  9.                 } 
  10.         } 

在logstash filter中使用multiline插件(不推荐):

(编辑:惠州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读