Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

nginx error log format is wrong #125

Closed
sanemat opened this issue Aug 13, 2014 · 4 comments
Closed

nginx error log format is wrong #125

sanemat opened this issue Aug 13, 2014 · 4 comments

Comments

@sanemat
Copy link

sanemat commented Aug 13, 2014

I read this (http://docs.fluentd.org/articles/common-log-formats) and set nginx error log format

<source>
    type tail
    format /^(?<time>[^ ]+ [^ ]+) \[(?<log_level>.*)\] (?<pid>[^#]*)#(?<tid>[^:]*): (?<message>.*)$/
    tag nginx.error
    path /var/log/nginx/error.log
</source>

But I met configtest error:

# service td-agent configtest
2014-08-13 10:23:15 -0400 [error]: Dry run failed: Unknown format template '/^(?<time>[^ ]+ [^ ]+) [(?<log_level>.*)] (?<pid>[^'

I think # acts comment out, and this works fine:

<source>
    type tail
    format /^(?<time>[^ ]+ [^ ]+) \[(?<log_level>.*)\] (?<pid>[^\#]*)\#(?<tid>[^:]*): (?<message>.*)$/
    tag nginx.error
    path /var/log/nginx/error.log
</source>

Now /var/log/td-agent/td-agent.log shows:

<source>
    type tail
    format /^(?<time>[^ ]+ [^ ]+) \[(?<log_level>.*)\] (?<pid>[^#]*)#(?<tid>[^:]*): (?<message>.*)$/
    tag nginx.error
    path /var/log/nginx/error.log
</source>

My environment:

# td-agent --version
td-agent 0.10.52
# dpkg -l|grep td-agent
ii  td-agent                            2.0.4-0                              amd64        Treasure Agent: A data collector for Treasure Data
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
# uname -a
Linux dev-do.mouse.tachikoma.io 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
@sanemat
Copy link
Author

sanemat commented Aug 13, 2014

oops, I read http://docs.fluentd.org/en/articles/config-file v1 format now.

@sanemat sanemat closed this as completed Aug 13, 2014
@sanemat
Copy link
Author

sanemat commented Aug 13, 2014

This is correct escape 😵

format /^(?<time>[^ ]+ [^ ]+) \\\[(?<log_level>.*)\\\] (?<pid>\[^\#\]*)\#(?<tid>\[^:\]*): (?<message>.*)$/

@kiyoto
Copy link
Contributor

kiyoto commented Aug 13, 2014

Thanks for the comment. Indeed, it was my mistake, and the current one doesn't work under any version (v1 or not). I will update and reference this ticket.

Thanks!

@kiyoto
Copy link
Contributor

kiyoto commented Aug 13, 2014

Fixed here: f2e9857

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants