Bug #43897
opencrash module reports UTC timestamps but doesn't format timestamps accordingly
0%
Description
This can be confusing:
~ # ceph health detail HEALTH_WARN 1 daemons have recently crashed RECENT_CRASH 1 daemons have recently crashed mon.c1boyd1 crashed on host c1boyd1 at 2020-01-28 01:35:32.305835Z ~ # date Mon Jan 27 19:05:47 MST 2020
The "Z" suffix on the datestring implies UTC iiuc but a +00 or so would probably be better.
Updated by Nathan Cutler about 4 years ago
- Assignee set to Nathan Cutler
I guess "2020-01-28 01:35:32.305835Z" is a variant of
$ date --utc --rfc-3339=seconds 2020-04-02 11:13:42+00:00
and the latter one does indeed look more user-friendly.
Updated by Nathan Cutler over 3 years ago
So, since the timestamp is guaranteed to be UTC, the solution would be to use the "time_from_string" method to convert it into a Python datetime object, and then re-create the string like so:
>>> print('{}+00:00'.format(datetime.datetime.utcnow().isoformat(' ', timespec='seconds'))) 2020-08-16 01:33:27+00:00
NOTE: in this example we are just generating an arbitrary datetime object using "datetime.datetime.utcnow()". The point is to show how to generate the timestamp string in the desired format.
Updated by Nathan Cutler over 3 years ago
- Status changed from New to In Progress
Updated by Nathan Cutler over 3 years ago
- Status changed from In Progress to Fix Under Review
- Pull request ID set to 36671
Updated by Nathan Cutler about 3 years ago
- Status changed from Fix Under Review to New
- Assignee deleted (
Nathan Cutler) - Pull request ID deleted (
36671)
see https://github.com/ceph/ceph/pull/36671 for one attempt to fix this "low-hanging fruit"
(Maybe "cosmetic issue with heavy test exposure" would be a better description than "low-hanging fruit" in this case?)
Updated by Nathan Cutler about 3 years ago
- Backport changed from octopus, nautilus to pacific, octopus, nautilus
Updated by Ernesto Puerta about 3 years ago
- Translation missing: en.field_tag_list set to low-hanging-fruit