Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Kubelet logs are retrieved from Journald because it is the only process that runs on the host (unlike the api, controller, manager processes that run as containers). This causes the kubelet's logging package (glog) to use the timestamp the host is set. In our test environments, this is EST. Containers are set to UTC, so the glog messages given by the other core services use the correct timestamps. Additionally, the agent is running within a container so it can assume that timestamps retrieved from /var/log/containers are using the same timezone as itself.
Log entry from a system set to EST time (this log shows up in the destination 5 hours in the past)
Journalctl output has two timestamps
Feb 02 14:14:03
14:14:03.962817
The log agent is running in a container, with UTC time. Because the timestamp in the glog message does not include a timezone, the agent assumes UTC (which is five hours in the past).
The Journald operator solves this by requesting UTC timestamps
Because the journald timestamp is within miliseconds of the glog timestamp, I think we should just use what journald gives us and ignore the time stamp parsed from the actual message field (glog message). This required two changes
drop_time
to not overwrite the timestamp field already set by journald inputdrop_time
field with a restructure operationThe alternative approach woudl be to give the user the option of setting a
kubelet_timezone
parameter. I think this adds unnecessary complication when we already have a reliable time source (asking journald to provide UTC).I have a test environment setup that can quickly replicate this, if anyone wants to hop on a call.