Skip to content

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

Merged
MrAnno merged 2 commits into
syslog-ng:masterfrom
bazsi:custom-timezone-for-a-time-macro
Jan 2, 2023
Merged

modules/timestamp: add $(format-date) template function#4202
MrAnno merged 2 commits into
syslog-ng:masterfrom
bazsi:custom-timezone-for-a-time-macro

Conversation

@bazsi
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator Author

bazsi commented Nov 3, 2022

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

@kira-syslogng
Copy link
Copy Markdown
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.

3 participants