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

Adding Math functions to line_format #2847

Closed
Leosirth opened this issue Oct 29, 2020 · 8 comments · Fixed by #3434
Closed

Adding Math functions to line_format #2847

Leosirth opened this issue Oct 29, 2020 · 8 comments · Fixed by #3434
Milestone

Comments

@Leosirth
Copy link

Is your feature request related to a problem? Please describe.
I have a scenario where AccessLogs from my reverse proxy have the duration logged as nanoseconds.
It would be great if I could format the extracted label "duration" as milliseconds (dividing it by 1000000).

Describe the solution you'd like
Having the Math and Conversion functions from sprig available on line_format as a follow-up of #2822 PR
Something like:

{log_type="access_log"}
| json
| line_format "{{.ClientHost}}\t{{.OriginStatus}}\t{{div (.Duration | int) 1000000}}\t{{.RequestScheme}}\t{{.RequestAddr}}\t{{.RequestPath}}"

Describe alternatives you've considered
Using Grafana to graph it as a metric

Additional context
http://masterminds.github.io/sprig/math.html
http://masterminds.github.io/sprig/conversion.html

@cyriltovena
Copy link
Contributor

I'm not against that.

/cc @grafana/loki-team who vouch for or against ?

I intentionally added strings functions only for now, wanted that we selectively choose what we add as we go.

@owen-d
Copy link
Member

owen-d commented Nov 4, 2020

I can see this being a nice thing to have.

@cyriltovena cyriltovena added this to the 2.2 milestone Nov 18, 2020
@stale
Copy link

stale bot commented Dec 19, 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 Dec 19, 2020
@Leosirth
Copy link
Author

Good bot, keep it open

@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Dec 19, 2020
@stale
Copy link

stale bot commented Jan 18, 2021

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 Jan 18, 2021
@Leosirth
Copy link
Author

Good bot, keep it open

@stale stale bot removed the stale A stale issue or PR that will automatically be closed. label Jan 19, 2021
@m4ver1k
Copy link

m4ver1k commented Feb 8, 2021

@cyriltovena is someone working on this ?
if not is it something I can give a try ?

@cyriltovena
Copy link
Contributor

We want to do it but we did not yet had the time so yeah go ahead

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

Successfully merging a pull request may close this issue.

4 participants