Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

nginx logs are not parsed using grok pattern

未关闭
#83 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
30/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
nginx, ruby

调研方向

首先复现所提供的 Fluentd 配置,并将其输出的记录与 issue 中显示的 Nginx 日志进行比较。调查为什么该模式在外部 Grok 调试器中有效,但在此 parser 配置下无效。当 access log 字段在 Fluentd 中被正确解析,且生成的记录包含预期值时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

I am using below grok_pattern for parsing Nginx logs

<source>

  @type tail
  path /data/nginxlogs/access.log
  pos_file /var/log/td-agent/nginx-access.log.pos
  tag es.nginx.acces
  <parse>
   @type multiline_grok
   <grok>
    pattern Started %{IPORHOST:client_ip} %{USER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] \"%{WORD:method} %{NOTSPACE:request_page} HTTP/%{NUMBER:http_version}\" %{NUMBER:server_response} %{NUMBER:bytes} \"%{URI:referrer}\" %{QS:user_agent}
#   grok_pattern %{MY_SUPER_PATTERN}
#   custom_pattern_path /etc/td-agent/MY_SUPER_PATTERN
#   multiline_start_regexp /^[^\s]/
  </grok>
  keep_time_key true
  </parse>
</source>
<filter es.nginx.acces>
  @type record_transformer
  <record>
  hostname ${hostname}
  </record>
</filter>
<match es.**>
  type "aws-elasticsearch-service"
  type_name "access_log"
  logstash_format true
 logstash_prefix "ngrokcontainer"
include_tag_key true
  tag_key "@log_name"
  flush_interval 1s
<endpoint>
    url http://testing-logs-ab-east-1.es.amazonaws.com
    region us-east-1
  </endpoint>
</match>

Kibana :

message 3.231.213.28 - - [18/Apr/2020:22:20:16 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.47.0" "-"
Its not parsing properly, but when I check this grok debugger its working fine.
Please let me know how I can fix this issue
主要语言
Ruby
星标
108
派生
32
平均合并
1 小时 47 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fluent/fluent-plugin-grok-parser 的其他 Issue

查看 fluent/fluent-plugin-grok-parser 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。