• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Hostname change not reflecting in sar report for CentOS/RHEL

by admin

The Problem

After changing the hostname from geeklab_old to geeklab_new, the sar report still shows the old hostname.

# sar -f /var/log/sa/sa09
Linux 5.4.17-2102.200.13.el8uek.x86_64 (geeklab_old) 04/09/2021 _x86_64_ (4 CPU)
...

The hostname change is reflected in /var/log/messages:

Apr 9 14:32:33 geeklab_old systemd[1]: Starting Hostname Service...
Apr 9 14:32:33 geeklab_old dbus-daemon[1117]: [system] Successfully activated service 'org.freedesktop.geeklab_old'
Apr 9 14:32:33 geeklab_old systemd[1]: Started Hostname Service.
Apr 9 14:32:33 geeklab_old systemd-hostnamed[6551]: Changed host name to 'geeklab_old'
Apr 9 14:32:44 geeklab_old systemd[1]: NetworkManager-dispatcher.service: Succeeded.
Apr 9 14:33:03 geeklab_old systemd[1]: systemd-hostnamed.service: Succeeded.
Apr 9 14:35:00 geeklab_old systemd[1]: Starting system activity accounting tool...
Apr 9 14:35:00 geeklab_old systemd[1]: sysstat-collect.service: Succeeded.
Apr 9 14:35:00 geeklab_old systemd[1]: Started system activity accounting tool.
Apr 9 14:40:00 geeklab_old systemd[1]: Starting system activity accounting tool...
Apr 9 14:40:00 geeklab_old systemd[1]: sysstat-collect.service: Succeeded.
Apr 9 14:40:00 geeklab_old systemd[1]: Started system activity accounting tool.
Apr 9 14:41:43 geeklab_old kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.4.17-2102.200.13.el8uek.x86_64 root=/dev/mapper/ol-root ro crashkernel=auto n
et.ifnames=0 biosdevname=0 resume=/dev/mapper/ol-swap rd.lvm.lv=ol/root rd.lvm.lv=ol/swap rd.lvm.lv=ol/usr rhgb quiet numa=off transparent_hugepage=never
Apr 9 14:41:43 geeklab_old kernel: Disabled fast string operations
Apr 9 14:41:43 geeklab_old kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'

The Solution

When you change the hostname, these changes will get reflected only in the newly created /var/log/sa/saXX logs. The new hostname will get updated from the next day’s /var/log/sa/saXX file.

If the current day’s log needs to be updated with the new hostname, follow the below steps:

1. Stop sysstat service:

# systemctl stop sysstat

2. Remove or take backup of current /var/log/sa/saXX file:

# mv /var/log/sa/sa09 /backup/

3. Start sysstat service:

# systemctl start sysstat

4. Confirm the hostname change:

# sar -f /var/log/sa/sa09
Linux 5.4.17-2102.200.13.el8uek.x86_64 (geeklab_new) 04/09/2021 _x86_64_ (4 CPU)
...

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. Backtick (`) symbol in Linux Shell Scripting
  2. How to merge 2 volume groups (VGs) into one using vgmerge in LVM
  3. lvdisplay error: “Failed to create directory /var/lock/lvm. File-based locking initilisation failed.”
  4. modprobe Command Options
  5. LVM Configuration : Logical Volume (LV) Operations/Utilities
  6. 18 Practical tcpdump Command Examples – A Network Sniffer Tool Primer
  7. CentOS / RHEL : How to find the creation time of LVM volume
  8. Understanding Linux SCSI Reservation
  9. Beginners Guide to Managing Package Module Streams in CentOS/RHEL 8
  10. How to disable avahi-daemon service in CentOS/RHEL

You May Also Like

Primary Sidebar

Recent Posts

  • grpck command – Remove corrupt or duplicate entries in the /etc/group and /etc/gshadow files.
  • xxd command – Expressed in hexadecimal form
  • sesearch: command not found
  • macof: command not found

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright