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

modules/timestamp: add $(format-date) template function #4202

Merged
merged 2 commits into from Jan 2, 2023

Conversation

bazsi
Copy link
Collaborator

@bazsi bazsi commented Nov 3, 2022

$(format-date [options] format-string [timestamp])

$(format-date) takes a timestamp in the DATETIME representation and formats it according to an strftime() format string. The DATETIME representation in syslog-ng is a UNIX timestamp formatted as a decimal number, with an optional fractional part, where the seconds and the fraction of seconds are separated by a dot.

If the timestamp argument is missing, the timestamp of the message is used.

Options:
--time-zone -- override timezone of the original timestamp

Signed-off-by: Balazs Scheidler bazsi77@gmail.com

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

No news file has been detected. Please write one, if applicable.

@bazsi bazsi force-pushed the custom-timezone-for-a-time-macro branch 2 times, most recently from 20e4eef to 7791a6d Compare November 3, 2022 18:58
@bazsi
Copy link
Collaborator Author

bazsi commented Nov 3, 2022

Note to self, this should probably be $(format-date) to match date-parser()

@kira-syslogng
Copy link
Contributor

Build FAILURE

@bazsi bazsi force-pushed the custom-timezone-for-a-time-macro branch 2 times, most recently from bb8a5da to 00f3ca0 Compare November 8, 2022 20:38
@bazsi bazsi changed the title modules/timestamp: add $(format-time) template function modules/timestamp: add $(format-date) template function Nov 11, 2022
$(format-date [options] format-string [timestamp])

$(format-date) takes a timestamp in the DATETIME representation and
formats it according to an strftime() format string.  The DATETIME
representation in syslog-ng is a UNIX timestamp formatted as a decimal
number, with an optional fractional part, where the seconds and the
fraction of seconds are separated by a dot.

If the timestamp argument is missing, the timestamp of the message is
used.

Options:
  --time-zone <TZstring> -- override timezone of the original timestamp

Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
@bazsi bazsi force-pushed the custom-timezone-for-a-time-macro branch from 00f3ca0 to 631e0b3 Compare November 11, 2022 07:39
@MrAnno MrAnno added this to the syslog-ng 4.1 milestone Dec 20, 2022
@MrAnno MrAnno merged commit c183850 into syslog-ng:master Jan 2, 2023
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 this pull request may close these issues.

None yet

3 participants