Date formats

The following is an explanation of how the NXLog Platform logs database handles various date formats. When sending logs from NXLog Agent to NXLog Platform, adhering to the supported date formats is important to avoid log events being saved with an incorrect timestamp.

Datetime fields

The NXLog Platform logs database stores dates as DateTime64 with nanoseconds (9) precision. Therefore, datetime fields must be in nanoseconds since the epoch. Datetime fields using other precisions, such as milliseconds or microseconds, will result in an incorrect date.

String fields containing dates

During parsing, the logs database tries to determine the best data type for each field. For string fields containing dates, the logs database is configured to use best_effort parsing, which supports all ISO 8601 date and time formats, including the following:

YYYY-MM-DD hh:mm:ss
YYYY-MM-DDThh:mm:ssTZ
YYYY-MM-DDThh:mm:ss.sTZ
YYYY-MM-DD hh:mm:ssTZ
YYYY-MM-DD hh:mm:ss.sTZ
YYYY-MM-DDThh:mm:ssUTC
YYYY-MM-DDThh:mm:ss.sUTC
YYYY-MM-DD hh:mm:ssUTC
YYYY-MM-DD hh:mm:ss.sUTC

See also Type inference for paths in the ClickHouse documentation.

You can change the default date format in NXLog Agent by setting the DateFormat global directive. Refer to Log event timestamps for more information on how NXLog Agent processes dates.