Skip to content

allow not appending timestamp to current log file#64

Merged
schmichael merged 3 commits intomainfrom
f-first-file-no-timestamp
Sep 17, 2021
Merged

allow not appending timestamp to current log file#64
schmichael merged 3 commits intomainfrom
f-first-file-no-timestamp

Conversation

@schmichael
Copy link
Copy Markdown
Member

@schmichael schmichael commented Sep 16, 2021

Backward compatible version of #62 -- This version does not change the
default behavior. Users must opt in to new behavior.

This patch updates the file sink to allow not appending the timestamp
on the current log file. In this mode the timestamp is only appended
when the file is rotated.

This matches the behavior:

The following example configures a destination called "My Sink" which
stores audit events at the file /tmp/audit.json.

Nomad's documentation is a little vague but implies the prior behavior
of always appending a timestamp.

@schmichael schmichael added the enhancement New feature or request label Sep 16, 2021
Backward compatible version of #62 -- This version does *not* change the
default behavior. Users must opt in to new behavior.

This patch updates the file sink to allow *not* appending the timestamp
on the current log file. In this mode the timestamp is only appended
when the file is rotated.

This matches the behavior:

- Implemented in Nomad v1.1.4 with hashicorp/nomad#11070
- Requested in hashicorp/nomad#11061

> The following example configures a destination called "My Sink" which
> stores audit events at the file `/tmp/audit.json`.

Nomad's documentation is a little vague but implies the prior behavior
of always appending a timestamp.
@schmichael schmichael force-pushed the f-first-file-no-timestamp branch from 837a4da to 23b3dd9 Compare September 16, 2021 22:39
While Go compares time using a monotonic clock that only prevents time from
moving *backward,* it does *not* guarantee time will move forward
between subsequent calls to `time.Now()`. The After assertion failed in
a test run on Github because it is missing the `Equal` comparison on the
preceeding assertion.
@schmichael schmichael merged commit 9071133 into main Sep 17, 2021
@schmichael schmichael deleted the f-first-file-no-timestamp branch September 17, 2021 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants