Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1834538

Summary: dnf logs shows utc timestamp instead of local time
Product: Red Hat Enterprise Linux 8 Reporter: Pradeep Jagtap <prjagtap>
Component: dnfAssignee: Lukáš Hrázký <lhrazky>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: urgent Docs Contact:
Priority: high    
Version: 8.2CC: abhavsar, amatej, james.antill, jcastran, jinjli, lhrazky, lilhuang, mblaha, mdomonko, mpoole, nsella, packaging-team-maint, sbalasub
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.4.2-2.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:00:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1887911, 1887916    
Bug Blocks: 1974772    

Description Pradeep Jagtap 2020-05-11 22:02:55 UTC
Description of problem:
------------------------
dnf logs show UTC timestamp instead of local time

Version-Release number of selected component (if applicable):
-------------------------------------------------------------
dnf-4.2.17-6.el8.noarch


Steps to Reproduce:
--------------------
[root@localhost ~]# rpm -qa | grep ^dnf
dnf-data-4.2.17-6.el8.noarch
dnf-plugins-core-4.0.12-3.el8.noarch
dnf-plugin-subscription-manager-1.23.8-35.el8.x86_64
dnf-plugin-spacewalk-2.8.5-9.module+el8+2754+6a08e8f4.noarch
dnf-4.2.17-6.el8.noarch

[root@localhost ~]# date
Tue May 12 02:53:51 IST 2020

[root@localhost ~]# tail -2 /var/log/dnf.log
2020-05-11T21:23:58Z DEBUG reviving: 'rhel-8-for-x86_64-baseos-rpms' can be revived - repomd matches.     <------------logged as per universal time
2020-05-11T21:23:59Z DEBUG rhel-8-for-x86_64-baseos-rpms: using metadata from Thu 07 May 2020 06:09:06 AM IST.

[root@localhost ~]# timedatectl 
               Local time: Tue 2020-05-12 02:54:43 IST     <------------ local time in IST
           Universal time: Mon 2020-05-11 21:24:43 UTC	   
                 RTC time: Mon 2020-05-11 21:24:43
                Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

[root@localhost ~]# yum history
Updating Subscription Management repositories.
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     3 | reinstall tree           | 2020-05-12 02:47 | R              |    2     <------------ reinstalled tree package as per local time 2020-05-12 02:47 IST
     2 | update dnf               | 2020-05-12 02:46 | I, U           |   23   
     1 |                          | 2019-10-08 19:27 | Install        | 1336 EE

[root@localhost ~]# cat /var/log/dnf.log | grep tree
2020-05-11T21:17:06Z DDEBUG Command: yum reinstall tree     <------------------------------ As per universal time 2020-05-11T21:17:06Z UTC
2020-05-11T21:17:06Z DDEBUG Extra commands: ['reinstall', 'tree']
2020-05-11T21:17:08Z DEBUG ---> Package tree.x86_64 1.7.0-15.el8 will be reinstalled 
 tree     x86_64     1.7.0-15.el8       rhel-8-for-x86_64-baseos-rpms      59 k
  tree-1.7.0-15.el8.x86_64                                                      
2020-05-11T21:17:15Z DDEBUG /var/cache/dnf/rhel-8-for-x86_64-baseos-rpms-51b3b78d5698246b/packages/tree-1.7.0-15.el8.x86_64.rpm removed


Expected results:
------------------
The dnf log should show local time instead of universal time.

Additional info
----------------
Similar behaviour observed in /var/log/secure logs

Comment 5 Lukáš Hrázký 2020-09-30 14:03:03 UTC
PR: https://github.com/rpm-software-management/dnf/pull/1670

The timezone of the debug log timestamp was changed to local time and the format was changed in e.g. this way:
before: 2020-09-30T13:34:58Z
after:  2020-09-30T15:37:03+0200

The Z indicated UTC and now there's the offset from UTC, according to ISO 8601.

Comment 23 errata-xmlrpc 2021-05-18 15:00:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (dnf bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1657