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

We want to use the rfc3339 standard but manually change the timezone #5352

Open
andreasfrischauf opened this issue Mar 29, 2024 · 2 comments

Comments

@andreasfrischauf
Copy link

Hello everyone,

We receive a lot of Logs from Network Devices that don't have any timezone information but are sent in UTC time.
Our receiving syslog server is located in GMT+1 timezone and because of this writes all of our events as though they were in the timezone GMT+1. This results in our logs being offset by one hour. The tool which further reads the data is unable to account for this error in the logs correctly, which leads to mismatched times for our logs. I didn't find any good way to prevent this error from happening other than changing the server timezone to UTC but since it is located in GMT+1 and also has other services running on it, we don't want to risk breaking the server.

We are currently using rfc-3339 for the timestamp format since we need the microseconds, because of our log volume.

Another solution that I thought would work was that I recreate the rfc-3339 standard using templates and then statically adding the offset as +00:00 which would work, however I didn't find any way to add microseconds from the parsed "timereported" field:

template(name="testTemplate" type="list") {
property(name="timereported" dateFormat="year")
constant(value="-")
property(name="timereported" dateFormat="month")
constant(value="-")
property(name="timereported" dateFormat="day")
constant(value="T")
property(name="timereported" dateFormat="hour")
constant(value=":")
property(name="timereported" dateFormat="minute")
constant(value=":")
property(name="timereported" dateFormat="second")
constant(value=".")
# This is not working
property(name="timereported" dateFormat="microsecond")
constant(value="+00:00 ")
property(name="fromhost-ip") # can also be set to 'hostname'
constant(value=" ")
property(name="syslogtag")
property(name="msg" spifno1stsp="on")
property(name="msg" droplastlf="on")
constant(value="\n")
}

Expected behavior

We want to control the timezone manually only for rsyslog without having to change the linux server timezone.

Actual behavior

Rsyslog is not able to do this?

Steps to reproduce the behavior

Environment

rsyslogd 8.2306.0 (aka 2023.06) compiled with:
PLATFORM: x86_64-suse-linux-gnu

@rgerhards
Copy link
Member

You can use "position.from" and "position.to" template options to obtain the subseconds - see template doc.

@davidelang
Copy link
Contributor

davidelang commented Mar 29, 2024 via email

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

No branches or pull requests

3 participants