Skip to main content

ParseLine

ParseLine splits a K8s log line into timestamp and message. K8s timestamped lines are formatted as: "2006-01-02T15:04:05.999999999Z message". If parsing fails, the full line is returned as the message with no timestamp.

def ParseLine(
line: string
) - > *dataplane.LogLine

Splits a Kubernetes log line into its timestamp and message components. If the line cannot be parsed according to the expected Kubernetes format, the entire line is returned as the message with no timestamp.

Parameters

NameTypeDescription
linestringThe Kubernetes log line to parse, expected to be in the format "2006-01-02T15:04:05.999999999Z message".

Returns

TypeDescription
*dataplane.LogLineA LogLine object containing the parsed timestamp and message, or the original line as the message if parsing fails.