I have a Java log file with entries starting with a timestamp like this:
2024-07-31 12:50:34,066 ERROR Sample error message here
In Ops Agent config.yaml, I tried to follow the instructions here:
https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/configuration
Given the format of the timestamp above, I have the processors like this:
processors:
parse_java_multiline:
type: parse_multiline
match_any:
- type: language_exceptions
language: java
extract_structure:
type: parse_regex
field: message
regex: "^(?<time>d{4}-d{2}-d{2} d{2}:d{2}:d{2},d{3}) (?<severity>S+) (?<message>(.|\n)*)$"
time_key: time
time_format: "%Y-%m-%d %H:%M:%S,%f"
move_severity:
type: modify_fields
fields:
severity:
move_from: jsonPayload.severity
In Log Explorer, the log entry’s jsonPayload will only contain the message, no timestamp.
The receiveTimestamp and timestamp both show the time when log was ingested and in this format:
"2024-08-01T03:57:33.369350969Z"
Question: How to display the timestamp in the log, and in the same format as the log entry?