[
https://issues.apache.org/jira/browse/NIFI-14179?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17936327#comment-17936327
]
Daniel Stieglitz edited comment on NIFI-14179 at 3/17/25 10:56 PM:
-------------------------------------------------------------------
Looks like the problem is that under the hood the expression language uses
java.time.format.DateTimeFormatter in the format method. In the
java.time.format.DateTimeFormatter grammer the letter Z means zone offset hence
with
"yyyy-MM-dd'T'HH:mm:ss.SZ"
the now() time gets translated into something like
{code:java}
2025-03-17T22:51:35.9+0000{code}
which clearly does not match the timestamp in
[[RFC5424|https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.3]|https://datatracker.ietf.org/doc/html/rfc5424].
The pattern should be
{code:java}
"yyyy-MM-dd'T'HH:mm:ss.S'Z'"{code}
{color:#172b4d}where the letter Z is escaped similarly to the letter T.{color}
was (Author: JIRAUSER294662):
Looks like the problem is that under the hood the expression language uses
java.time.format.DateTimeFormatter in the format method. In the
java.time.format.DateTimeFormatter grammer the letter Z means zone offset hence
with
"yyyy-MM-dd'T'HH:mm:ss.SZ"
the now() time gets translated into something like
{code:java}
2025-03-17T22:51:35.9+0000{code}
which clearly does not match the timestamp in
[RFC5424|https://datatracker.ietf.org/doc/html/rfc5424].
The pattern should be
{code:java}
"yyyy-MM-dd'T'HH:mm:ss.S'Z'"{code}
{color:#172b4d}where the letter Z is escaped similarly to the letter T.{color}
> PutSyslog marks invalid messages with Z timezone
> ------------------------------------------------
>
> Key: NIFI-14179
> URL: https://issues.apache.org/jira/browse/NIFI-14179
> Project: Apache NiFi
> Issue Type: Bug
> Affects Versions: 1.27.0
> Reporter: Martin Hynar
> Assignee: Daniel Stieglitz
> Priority: Major
>
> Hello team, I just discovered that PutSyslog processor routes messages with Z
> timezone to invalid relationship.
>
> Setting up sample PutSyslog processor with (format taken from NiFi
> documentation)
> {code:java}
> Message Timestamp: ${now():format("yyyy-MM-dd'T'HH:mm:ss.SZ")}
> {code}
>
> Same problem applies also to format yyyy-MM-dd'T'HH:mm:ssZ
> The +hh:mm form does not have the problem.
>
>
> Other parameters are fixed
> {code:java}
> Message Priority: 1
> Message Hostname: example.com
> Message Body: message
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)