Skip to content

LogQL: Common Log Format Support for Server Logs #2783

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

Closed
jeschkies opened this issue Oct 20, 2020 · 9 comments
Closed

LogQL: Common Log Format Support for Server Logs #2783

jeschkies opened this issue Oct 20, 2020 · 9 comments
Labels
keepalive An issue or PR that will be kept alive and never marked as stale. revivable We'd like this, but not immediately prioritizing. Please open a PR!

Comments

@jeschkies
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Most servers such as Apache HTTP Server and Nginx use the Common Log Format. This format is not easy to parse with regular expression.

Describe the solution you'd like
It would be nice to have a cmn_log_fmt or server_log parser along side logfmt and json to extract all values from a server log.

Describe alternatives you've considered
As mentioned in the problem statement regular expression can parse the server log. An alternative solution would be re-usability of parsers.

@stale
Copy link

stale bot commented Nov 20, 2020

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Nov 20, 2020
@cyriltovena cyriltovena added keepalive An issue or PR that will be kept alive and never marked as stale. and removed stale A stale issue or PR that will automatically be closed. labels Nov 20, 2020
@RichardWright
Copy link

As someone who's currently searching for a regex to do this for loki, I do feel this should be built in.

@n2o
Copy link

n2o commented Dec 17, 2020

Same here, I think this should be a built-in :-)

@agebhar1
Copy link
Contributor

FWIW - a Go(lang) RE2 for the Common Log Format is:

^(?P<remote_host>\\S+) (?P<user_identifier>\\S+) (?P<user>\\S+) \\[(?P<ts>[^\\]]+)\\] \\"(?P<request>[^\\"]+)\\" (?P<status>\\d+) (?P<bytes_sent>\\d+|-)$

and with extracted request line:

^(?P<remote_host>\\S+) (?P<user_identifier>\\S+) (?P<user>\\S+) \\[(?P<ts>[^\\]]+)\\] \\"(?P<method>\\S+) (?P<path>\\S+) HTTP/(?P<http_version>\\d+\\.\\d+)\\" (?P<status>\\d+) (?P<bytes_sent>\\d+|-)$

@owen-d owen-d added the revivable We'd like this, but not immediately prioritizing. Please open a PR! label Mar 4, 2021
@owen-d
Copy link
Member

owen-d commented Mar 4, 2021

This is a reasonable request, but not one we intend to prioritize highly.

@owen-d owen-d closed this as completed Mar 4, 2021
@colmaengus
Copy link

Is there planned support for custom named parsers? This would allow users to use custom regexp without having to copy and paste it into each query.

@cyriltovena
Copy link
Contributor

I'm working on this

@cyriltovena cyriltovena reopened this May 13, 2021
@dannykopping
Copy link
Contributor

Satisfied by the new Pattern Parser: https://grafana.com/docs/loki/next/logql/#pattern

@timwsuqld
Copy link

timwsuqld commented Oct 20, 2022

@dannykopping Did the pattern parser get released? The link no longer references it, and it was listed as beta looking at the link in the way back machine

Edit: Looks like it was released, found the correct link for details to be https://grafana.com/docs/loki/latest/logql/log_queries/#pattern

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive An issue or PR that will be kept alive and never marked as stale. revivable We'd like this, but not immediately prioritizing. Please open a PR!
Projects
None yet
Development

No branches or pull requests

9 participants