Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tail errors with malformed log line for Apache2.2 access log file #4442

Closed
fjb4280 opened this issue Jul 20, 2018 · 3 comments
Closed

tail errors with malformed log line for Apache2.2 access log file #4442

fjb4280 opened this issue Jul 20, 2018 · 3 comments

Comments

@fjb4280
Copy link

fjb4280 commented Jul 20, 2018

Relevant telegraf.conf:

Stream a log file, like the tail -f command

[[inputs.tail]]
  name_override = "wb_http"
  files = ["E:/Apache2.2/logs/access_*_00-00-00.log"]
  from_beginning = false
  pipe = false
  watch_method = "poll"
  data_format = "influx"

System info:

Telegraf version: 1.7.2
operating system name: Windows Server 2008 R2 SP1

Steps to reproduce:

n/a

Expected behaviour:

Successful tailing of Apache 2.2 log file with custom log format.

Actual behaviour: (note some text scrambled for privacy)

2018-07-20T01:24:53Z E! Error in plugin [inputs.tail]: E! Malformed log line in E:\Apache2.2\logs\access_2018-07-20_00-00-00.log: [10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] "GET /abc/js/json-181560333.js HTTP/1.1" 200 17862 0
], Error: metric parse error: expected field at offset 16: "10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] \"GET /abc/js/json-181560333.js HTTP/1.1\" 200 17862 0\n"
2018-07-20T01:24:53Z E! Error in plugin [inputs.tail]: E! Malformed log line in E:\Apache2.2\logs\access_2018-07-20_00-00-00.log: [10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] "GET /abc/lib/jquery-migrate/jquery-migrate-1.2.1.min-181560333.js HTTP/1.1" 200 7199 0
], Error: metric parse error: expected field at offset 16: "10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] \"GET /abc/lib/jquery-migrate/jquery-migrate-1.2.1.min-181560333.js HTTP/1.1\" 200 7199 0\n"
2018-07-20T01:24:53Z E! Error in plugin [inputs.tail]: E! Malformed log line in E:\Apache2.2\logs\access_2018-07-20_00-00-00.log: [10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] "GET /abc/lib/jquery/jquery-1.11.1-181560333.js HTTP/1.1" 200 282766 31250
], Error: metric parse error: expected field at offset 16: "10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] \"GET /abc/lib/jquery/jquery-1.11.1-181560333.js HTTP/1.1\" 200 282766 31250\n"
2018-07-20T01:24:53Z E! Error in plugin [inputs.tail]: E! Malformed log line in E:\Apache2.2\logs\access_2018-07-20_00-00-00.log: [10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] "GET /abc/master.css HTTP/1.1" 200 70462 0
], Error: metric parse error: expected field at offset 16: "10.0.0.1 - - [20/Jul/2018:11:24:52 +1000] \"GET /abc/master.css HTTP/1.1\" 200 70462 0\n"

Additional info:

n/a

@glinton
Copy link
Contributor

glinton commented Jul 20, 2018

You should use data_format = "grok" instead of influx and set grok_patterns = ["%{COMMON_LOG_FORMAT}"] as defined here to parse common nginx/apache logs.
I'll reopen this if that doesn't work for you.

@glinton glinton closed this as completed Jul 20, 2018
@fjb4280
Copy link
Author

fjb4280 commented Jul 23, 2018

From what I understand Telegraf version 1.7.2 does not support data format grok as defined here:
https://github.com/influxdata/telegraf/blob/**1.7.2**/docs/DATA_FORMATS_INPUT.md

Here is the output of telegraf --test when using data format grok

C:\Program Files\Telegraf>telegraf --test

2018/07/23 11:01:38 I! Using config file: C:\Program Files\Telegraf\telegraf.conf
2018/07/23 11:01:38 E! Error parsing C:\Program Files\Telegraf\telegraf.conf, Invalid data format: grok

@glinton
Copy link
Contributor

glinton commented Jul 23, 2018

Ah, good catch! This pr should have added it, I'll verify and have that added to that doc, thanks.

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

No branches or pull requests

2 participants