Skip to content

[receiver/filelog] Support detection of headers in header-based log formats (e.g. W3C) #18198

Closed
@BinaryFissionGames

Description

@BinaryFissionGames

Component(s)

receiver/filelog

Is your feature request related to a problem? Please describe.

The W3C log format defines its fields through a list of headers. This allows any agent that is aware of these headers to parse any W3C log, even if the headers change mid-way through the log file (as they could in e.g. Microsoft IIS logs).

The filelog receiver currently does not support parsing these fields and using them to parse CSV lines.

Describe the solution you'd like

Ideally, there would be some way to configure the filelog receiver to recognize and pass these headers to the CSV parser so that the log lines can be parsed based on the headers.

In Stanza, this functionality was implemented in the following PRs:

Tangentially related:

The way it worked was the the filelog receiver would save the header line, adding it as an attribute to each log record read from the file.

Later in the pipeline, the CSV file would be able to use this attribute as dynamic headers, which allowed the log line to be parsed based on the header attribute that the filelog receiver added.

Describe alternatives you've considered

I haven't thought of other solutions besides the one implemented in stanza; Would love to hear other ideas!

Additional context

Sample W3C log line, for context:

W3C log
#Software: Microsoft Internet Information Services 10.0
#Version: 1.0
#Date: 2022-08-09 20:25:26
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2022-08-09 20:25:26 W3SVC1 <Server> 127.0.0.1 GET /query param1=1&parma2=2 80 - 127.0.0.1 HTTP/1.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:103.0)+Gecko/20100101+Firefox/103.0 - - localhost 404 0 2 5029 464 83
2022-08-09 20:25:29 W3SVC1 <Server> 127.0.0.1 GET /query - 80 - 127.0.0.1 HTTP/1.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:103.0)+Gecko/20100101+Firefox/103.0 - - localhost 404 0 2 5007 446 1
2022-08-09 20:25:32 W3SVC1 <Server> 127.0.0.1 GET / - 80 - 127.0.0.1 HTTP/1.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:103.0)+Gecko/20100101+Firefox/103.0 - - localhost 200 0 0 927 441 1
2022-08-09 20:25:32 W3SVC1 <Server> 127.0.0.1 GET /iisstart.png - 80 - 127.0.0.1 HTTP/1.1 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64;+rv:103.0)+Gecko/20100101+Firefox/103.0 - http://localhost/ localhost 200 0 0 99937 374 7

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions