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

promtail dry-run to include fractions of second in timestamp #3955

Closed
samjewell opened this issue Jul 7, 2021 · 1 comment · Fixed by #4006
Closed

promtail dry-run to include fractions of second in timestamp #3955

samjewell opened this issue Jul 7, 2021 · 1 comment · Fixed by #4006
Labels
component/promtail type/feature Something new we should do

Comments

@samjewell
Copy link
Contributor

samjewell commented Jul 7, 2021

Problem

I want to confirm that my timestamp pipeline_stage is working correctly in dry-run mode, before I run promtail "for-real" and send the logs into my Loki instance (because I don't want to sent bad data into Loki).

But dry-run mode only shows whole seconds for the timestamp for each log-line, so I can only confirm that it's working to the nearest second.

Example log lines used for testing this:

level=INFO time=1625253244.5699751 Server=30690 Jitter=4.796ms
level=INFO time=1625253360.99699 Server=34931 Jitter=0.719ms

Pipeline stage:

  pipeline_stages:
  - regex:
      expression: "time=(?P<time>\\S+) "
  - timestamp:
      source: time
      format: Unix
      action_on_failure: skip

Output from promtail -dry-run:

2021-07-02T20:14:04	{filename="/Users/samjewell/fana/run-promtail/example.log", job="testtimestampparsing"}level=INFO time=1625253244.5699751 Server=30690 Jitter=4.796ms
2021-07-02T20:16:00	{filename="/Users/samjewell/fana/run-promtail/example.log", job="testtimestampparsing"}level=INFO time=1625253360.99699 Server=34931 Jitter=0.719ms

(or in colour)
image

Solution

Possibly switch to tsNs in this output more, or simply add decimals when present?

1625253244569975100 {filename=…

Or

2021-07-02T20:14:04.5699751	{filename=…

Alternatives

Maybe simply a flag which could be enabled, in order to add this additional output to the timestamp, if you don't want to make this change permanent for all users (as it could make the output less well aligned and harder to read in some cases I guess).

Additional context

The sub-second fractions are indeed being handled correctly by promtail and Loki - see:
image

@dannykopping dannykopping added component/promtail type/feature Something new we should do labels Jul 7, 2021
@dannykopping
Copy link
Contributor

Thanks for submitting this @samjewell!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/promtail type/feature Something new we should do
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants