gpt4 book ai didi

apache - Fluentd apache 格式 [警告] : pattern not match:

转载 作者:行者123 更新时间:2023-12-04 18:01:04 25 4
gpt4 key购买 nike

在我的/etc/fluent/fluent.conf 中

<source>
@type tail
format apache2
path /var/log/apache2/other_vhosts_access.log
tag apache2.access
</source>

Error / warn : 2016-02-11 00:59:10 +0100 [warn]: pattern not match: "mybebsite.dz:443 105.101.114.234 - - [11/Feb/2016:00:59:10 +0100] \"POST /__es/_all/_search HTTP/1.1\" 200 794 \"https://mywebsite.net/\" \"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0\""

为什么这个模式不匹配?最好的。

最佳答案

我在 fluentd 中一直面临警告:模式不匹配,因此我的过滤器部分无法正常工作。然后我认真对待这个警告并通过创建正则表达式解决了这个问题。所以,我的 td-agent.conf 如下:

 <source>
@type tail
format **/^([^ ]*) (?<host>[^ ]*) [^ ]* "(?<method>\S+) (?<path>[^ ]* +\S*)? (?<code>[^ ]*) (?<size>[^ ]*) (?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?/**
path /var/log/apache2/access.log
pos_file /var/log/td-agent/httpd.access.pos
tag s3.apache.access
</source>
<filter **>
@type grep
<regexp>
key path
pattern \/aws\/project_launch\/view\/[\w\W]*
</regexp>
</filter>
<match **>
@type s3
aws_key_id xxxxxx
aws_sec_key xxxxxx
s3_bucket bucketalifluentd
s3_region eu-west-1
path logs_viewshare/
buffer_path /var/log/td-agent/buffer/s3
time_slice_format %Y-%m-%d/%H
time_slice_wait 2m
</match>

请注意,apache2 日志可能与您不同,因为您在apache2.conf 中进行了不同的配置。您可以使用 rubular

用于在 ruby​​ 中创建正则表达式,因为 fluentd/td-agent 是用 ruby​​ 编写的。之后您可以在目录/var/log/td-agent/buffer/s3.xxx

中查看收集了您的日志的缓冲区

关于apache - Fluentd apache 格式 [警告] : pattern not match:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35328428/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com