Skip to content

Wrong (invalid) Syslog Timestamps (depends on location) #36

Description

@ndsvw

The month of a Syslog timestamp is defined as one of these values: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec (https://tools.ietf.org/html/rfc3164#section-4.1.2)

But if you are located in special countries (Germany for example, but a lot more), the line
timestamp = String.Concat(dt.ToString("MMM "), day, dt.ToString(" HH:mm:ss"));
could result in month names like "Mrz", "Dez"...

They are not valid!

This is easily solvable by adding CultureInfo.InvariantCulture as 2nd parameter of DateTime.toString:

timestamp = String.Concat(dt.ToString("MMM ", CultureInfo.InvariantCulture), day, dt.ToString(" HH:mm:ss", CultureInfo.InvariantCulture));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions