Bug 2189281
| Summary: | insights-client change log management to logrotate standard | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Alba Hita <ahitacat> |
| Component: | insights-client | Assignee: | Jason Jerome <jajerome> |
| Status: | CLOSED ERRATA | QA Contact: | Red Hat subscription-manager QE Team <rhsm-qe> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 9.3 | CC: | ahitacat, arpandey, bkinney, cmarinea, dranck, fjansen, jajerome, klape, link, lphiri, pakotvan, peter.vreman, ptoscano, robwilli, stomsa |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | insights-client-3.2.0-1.el9 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1940267 | Environment: | |
| Last Closed: | 2023-11-07 08:32:52 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: | 1940267 | ||
| Bug Blocks: | |||
Final Verification on build insights-client-3.2.0-1.el9.noarch Bug has been verified by running automated tests https://main-jenkins-csb-insights-qe.apps.ocp-c1.prod.psi.redhat.com/job/rhc_and_insights_clients/job/main_rhc_insights/9022/testReport/csbprodrhel93.tests/test_client/ some logs to support verification from jenkins console : + rpm -qa + grep insights-client insights-client-3.2.0-1.el9.noarch tests/test_client.py::test_verify_logrotate_is_configured <- ../../../../../../iqe_venv/lib/python3.8/site-packages/iqe_insights_client/tests/test_client.py Content of log file is /var/log/insights-client/*.log { rotate 4 weekly missingok notifempty copytruncate } -------------------------------- live log call --------------------------------- 2023-07-21 08:11:28 INFO Content of log file is /var/log/insights-client/*.log { rotate 4 weekly missingok notifempty copytruncate } PASSED [ 13%] tests/test_client.py::test_verify_logrotate_when_forced_conf <- ../../../../../../iqe_venv/lib/python3.8/site-packages/iqe_insights_client/tests/test_client.py -------------------------------- live log call --------------------------------- 2023-07-21 08:11:28 INFO log file size before test is 258606 2023-07-21 08:11:28 INFO number of log files before test is : 1 2023-07-21 08:11:28 INFO Starting to collect Insights data for rhiqe.a3e02360-9e2b-42bd-b0e0-e6685e198015.iqe-insights-client-plugin 2023-07-21 08:11:57 INFO Uploading Insights data. 2023-07-21 08:12:05 INFO Successfully uploaded report for rhiqe.a3e02360-9e2b-42bd-b0e0-e6685e198015.iqe-insights-client-plugin. 2023-07-21 08:12:05 INFO View the Red Hat Insights console at https://console.redhat.com/insights/ PASSED Based on automated test results - Verification: Passed 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 (insights-client 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-2023:6432 |
pre-verification: [root@iqe-insightsvm-arpandey-9 ~]# insights-client --version Client: 3.2.0 Core: 3.0.8-dev [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# rpm -qa | grep insights-client insights-client-3.2.0.git.424.5dfefcf7-0.el9.noarch [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 5168 -rw-r--r--. 1 root root 815439 Jun 8 10:10 insights-client.log -rw-r--r--. 1 root root 3978824 Jun 8 07:01 insights-client.log.1 [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# cat /etc/logrotate.d/insights-client /var/log/insights-client/*.log { rotate 4 weekly missingok notifempty sharedscripts copytruncate create 0644 root root }[root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# insights-client Starting to collect Insights data for iqe-insightsvm-arpandey-9 Uploading Insights data. Successfully uploaded report from iqe-insightsvm-arpandey-9 to account 6089719. View details about this system on console.redhat.com: https://console.redhat.com/insights/inventory/07e2e735-f7b4-45d3-b02f-f57104a433e3 [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 5168 -rw-r--r--. 1 root root 1209457 Jun 8 10:11 insights-client.log -rw-r--r--. 1 root root 3978824 Jun 8 07:01 insights-client.log.1 <<<< log file not rotated on every run of insights-client [root@iqe-insightsvm-arpandey-9 ~]# insights-client Starting to collect Insights data for iqe-insightsvm-arpandey-9 Uploading Insights data. Successfully uploaded report from iqe-insightsvm-arpandey-9 to account 6089719. View details about this system on console.redhat.com: https://console.redhat.com/insights/inventory/07e2e735-f7b4-45d3-b02f-f57104a433e3 [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 6192 -rw-r--r--. 1 root root 1605973 Jun 8 10:11 insights-client.log -rw-r--r--. 1 root root 3978824 Jun 8 07:01 insights-client.log.1 <<<<<< log file not rotated on every run of insights-client [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# logrotate -vf /etc/logrotate.d/insights-client << testing if logrotate feature rotates the log reading config file /etc/logrotate.d/insights-client Reading state from file: /var/lib/logrotate/logrotate.status Allocating hash table for state file, size 64 entries Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Handling 1 logs rotating pattern: /var/log/insights-client/*.log forced from command line (4 rotations) empty log files are not rotated, old logs are removed considering log /var/log/insights-client/insights-client.log Now: 2023-06-08 10:12 Last rotated at 2023-06-08 07:01 log needs rotating rotating log /var/log/insights-client/insights-client.log, log->rotateCount is 4 dateext suffix '-20230608' glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' set default create context to unconfined_u:object_r:insights_client_var_log_t:s0 renaming /var/log/insights-client/insights-client.log.4 to /var/log/insights-client/insights-client.log.5 (rotatecount 4, logstart 1, i 4), old log /var/log/insights-client/insights-client.log.4 does not exist renaming /var/log/insights-client/insights-client.log.3 to /var/log/insights-client/insights-client.log.4 (rotatecount 4, logstart 1, i 3), old log /var/log/insights-client/insights-client.log.3 does not exist renaming /var/log/insights-client/insights-client.log.2 to /var/log/insights-client/insights-client.log.3 (rotatecount 4, logstart 1, i 2), old log /var/log/insights-client/insights-client.log.2 does not exist renaming /var/log/insights-client/insights-client.log.1 to /var/log/insights-client/insights-client.log.2 (rotatecount 4, logstart 1, i 1), renaming /var/log/insights-client/insights-client.log.0 to /var/log/insights-client/insights-client.log.1 (rotatecount 4, logstart 1, i 0), old log /var/log/insights-client/insights-client.log.0 does not exist log /var/log/insights-client/insights-client.log.5 doesn't exist -- won't try to dispose of it copying /var/log/insights-client/insights-client.log to /var/log/insights-client/insights-client.log.1 set default create context to unconfined_u:object_r:insights_client_var_log_t:s0 truncating /var/log/insights-client/insights-client.log set default create context to unconfined_u:object_r:logrotate_var_lib_t:s0 [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 5460 -rw-r--r--. 1 root root 0 Jun 8 10:12 insights-client.log -rw-r--r--. 1 root root 1608678 Jun 8 10:12 insights-client.log.1 -rw-r--r--. 1 root root 3978824 Jun 8 07:01 insights-client.log.2 << log file rotated as expected [root@iqe-insightsvm-arpandey-9 ~]# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Test Case: Insights-client updated, old version of core [root@iqe-insightsvm-arpandey-9 ~]# insights-client --version Client: 3.2.0 Core: 3.1.26-1 [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 448 -rw-r--r--. 1 root root 398475 Jun 8 10:19 insights-client.log [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# insights-client Starting to collect Insights data for iqe-insightsvm-arpandey-9 Uploading Insights data. Successfully uploaded report from iqe-insightsvm-arpandey-9 to account 6089719. View details about this system on console.redhat.com: https://console.redhat.com/insights/inventory/07e2e735-f7b4-45d3-b02f-f57104a433e3 [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 924 -rw-r--r--. 1 root root 944226 Jun 8 10:23 insights-client.log [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# logrotate -vf /etc/logrotate.d/insights-client <<< forcing log rotate reading config file /etc/logrotate.d/insights-client Reading state from file: /var/lib/logrotate/logrotate.status Allocating hash table for state file, size 64 entries Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Creating new state Handling 1 logs rotating pattern: /var/log/insights-client/*.log forced from command line (4 rotations) empty log files are not rotated, old logs are removed considering log /var/log/insights-client/insights-client.log Now: 2023-06-08 10:24 Last rotated at 2023-06-08 10:12 log needs rotating rotating log /var/log/insights-client/insights-client.log, log->rotateCount is 4 dateext suffix '-20230608' glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' set default create context to unconfined_u:object_r:insights_client_var_log_t:s0 renaming /var/log/insights-client/insights-client.log.4 to /var/log/insights-client/insights-client.log.5 (rotatecount 4, logstart 1, i 4), old log /var/log/insights-client/insights-client.log.4 does not exist renaming /var/log/insights-client/insights-client.log.3 to /var/log/insights-client/insights-client.log.4 (rotatecount 4, logstart 1, i 3), old log /var/log/insights-client/insights-client.log.3 does not exist renaming /var/log/insights-client/insights-client.log.2 to /var/log/insights-client/insights-client.log.3 (rotatecount 4, logstart 1, i 2), old log /var/log/insights-client/insights-client.log.2 does not exist renaming /var/log/insights-client/insights-client.log.1 to /var/log/insights-client/insights-client.log.2 (rotatecount 4, logstart 1, i 1), old log /var/log/insights-client/insights-client.log.1 does not exist renaming /var/log/insights-client/insights-client.log.0 to /var/log/insights-client/insights-client.log.1 (rotatecount 4, logstart 1, i 0), old log /var/log/insights-client/insights-client.log.0 does not exist log /var/log/insights-client/insights-client.log.5 doesn't exist -- won't try to dispose of it copying /var/log/insights-client/insights-client.log to /var/log/insights-client/insights-client.log.1 set default create context to unconfined_u:object_r:insights_client_var_log_t:s0 truncating /var/log/insights-client/insights-client.log set default create context to unconfined_u:object_r:logrotate_var_lib_t:s0 [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# [root@iqe-insightsvm-arpandey-9 ~]# ll /var/log/insights-client/ total 924 -rw-r--r--. 1 root root 0 Jun 8 10:24 insights-client.log -rw-r--r--. 1 root root 944226 Jun 8 10:24 insights-client.log.1 <<<< log rotated successfully [root@iqe-insightsvm-arpandey-9 ~]# verified that logrotate is being used because the insights client have logrotate implementation. Setting verified tested.