在我的/etc/fluent/fluent.conf中
@type尾格式apache2路径/var/log/apache2/other_vhosts_access.log标记apache2.access
错误/警告:2016年2月11日○点59分10秒0100 [警告]:图案不匹配:"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 \“”
为什么这个模式不匹配?最好 .
2 回答
似乎tail插件不支持apache日志格式"vhost_combined"但"combined"的格式 .
如何更改apache配置文件如下:
/etc/apache2/conf-available/other-vhosts-access-log.conf
之前:
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
(将 vhost_combined 更改为 combined )
之后:
CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log combined
我一直面对流利的 warn: pattern not match ,因此我的过滤部分无效 . 然后我认真对待这个警告并通过创建一个正则表达式来解决这个问题 . 所以,我的td-agent.conf如下:
请注意,apache2日志可能与您有所不同,因为您在 apache2.conf 中进行了不同的配置 . 你可以用rubular
用于在ruby中创建正则表达式,因为流利/ td-agent已用ruby编写 . 之后,您可以在目录 /var/log/td-agent/buffer/s3.xxx 中查看已收集日志的缓冲区