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

Ability to specify unit/precision of access log duration #2877

Closed
derekargueta opened this issue Mar 22, 2018 · 2 comments
Closed

Ability to specify unit/precision of access log duration #2877

derekargueta opened this issue Mar 22, 2018 · 2 comments
Assignees
Labels
enhancement Feature requests. Not bugs or questions.
Milestone

Comments

@derekargueta
Copy link
Member

Title: Ability to specify unit/precision of access log duration

Description:
Durations are hard-coded to milliseconds, it would be super convenient to be able to specify the unit i.e. seconds so that 3 milliseconds is logged as 0.003. Additionally, from the code, it appears that the duration is stored using chrono::nanoseconds so it shouldn't be difficult to provide precision control from ns and up (our previous system provides ns precision and we're working for on-par drop-in replacement for logging). An example of the final result is that someone could specify seconds-unit but with nanosecond precision.

Somewhat related to issue #2709 - I'm willing to provide an implementation.

@zuercher zuercher added enhancement Feature requests. Not bugs or questions. help wanted Needs help! labels Mar 23, 2018
@mattklein123 mattklein123 removed the help wanted Needs help! label May 18, 2018
@mattklein123 mattklein123 added this to the 1.7.0 milestone May 18, 2018
htuch pushed a commit that referenced this issue Jun 6, 2018
This change adds %f, %[1-9]f specifier to get subseconds for START_TIME.
As an example, START_TIME(%s%3f) gets a timestamp in milliseconds.

This also adds START_TIME as one of the supported variables in header formatter.

Risk Level: Low, since this is an optional feature.

Testing: unit and manual tests.

Docs Changes:

added subsecond specifier for START_TIME for both access_log and router header formatter.
added START_TIME as one of the supported variables in header formatter.
Release Notes:

added subsecond specifier for START_TIME for both access_log and router header formatter.
added START_TIME as one of the supported variables in header formatter.
Fixes #1966
Fixes #2877

Signed-off-by: Dhi Aurrahman <dio@rockybars.com>
@moadi
Copy link

moadi commented May 25, 2021

@htuch does this only apply to START_TIME, or can I use this mechanism to format other duration entries too? looking at the docs it only seems to specify that we can format START_TIME

@htuch
Copy link
Member

htuch commented May 26, 2021

@moadi I think you are right; PRs welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests. Not bugs or questions.
Projects
None yet
Development

No branches or pull requests

6 participants