【问题标题】:Using Grok parser in Fluentd在 Fluentd 中使用 Grok 解析器
【发布时间】:2016-10-27 10:52:54
【问题描述】:

我正在寻找一种使用 grok 解析器来解析数据的方法,但我似乎对如何使用它感到困惑。 我的目的是我想使用过滤器使用 grok 模式添加其他字段。

类似:

<filter acme.**>
    @type parser
    key_name log
    format grok
    <parse>
        <grok>
            @type grok
            grok_pattern grok_pattern %{TIMESTAMP_ISO8601:time_stamp}%{SPACE}
        </grok>
    </parse>
</filter>

使用这个 Fluend 抱怨或警告很多东西没有使用..

  • ...中的参数“@type”未使用。
  • .. 节中的参数“grok_pattern”未使用

关于如何使用过滤器在 Fluentd 中使用 Grok 解析器的提示?

【问题讨论】:

    标签: logging grok fluentd


    【解决方案1】:

    它适用于 Fluentd v0.12.29 包含的过滤器解析器插件的以下配置。 &lt;parse&gt; 部分不适用于 v012.29。 它从 v0.14 开始可用,但 Fluentd v0.14.8 不包含过滤器解析器插件。 见https://github.com/fluent/fluentd/pull/1191

    而且 ttps://github.com/tagomoris/fluent-plugin-parser 目前不支持 Fluentd v0.14。

    <source>
      @type dummy
      tag dummy.log
      dummy [
        { "message": "Oct 24 09:01:33 mymachine uim-toolbar[5831]: Theme parsing error: <data>:2:30: The style property GtkWidget:focus-line-width is deprecated and shouldn't be used anymore. It will be removed in a future version" },
        { "message": "Oct 24 09:01:33 mymachine uim-toolbar[5831]: Theme parsing error: <data>:3:27: The style property GtkWidget:focus-padding is deprecated and shouldn't be used anymore. It will be removed in a future version" },
        { "message": "Oct 24 09:01:33 mymachine uim-toolbar[5831]: Theme parsing error: <data>:2:30: The style property GtkWidget:focus-line-width is deprecated and shouldn't be used anymore. It will be removed in a future version" }
      ]
    </source>
    
    <filter **>
      @type parser
      key_name message
      format grok
      grok_pattern %{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST:host} %{SYSLOGPROG}: %{GREEDYDATA:message}
    </filter>
    
    <match **>
      @type stdout
    </match>
    

    另见https://github.com/fluent/fluent-plugin-grok-parser/issues/23

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-07-18
      • 1970-01-01
      • 1970-01-01
      • 2017-05-18
      • 2021-03-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多