• 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. ispell Command Examples in Linux
  2. mkfs Command Examples in Linux
  3. CentOS / RHEL 6 : How to boot into rescue mode
  4. Rabbitmq install and management
  5. RPM : package installation Error : cpio: read failed
  6. dconf : command not found
  7. notify-send Command Examples in Linux
  8. CentOS / RHEL : How to configure iptable rules to allow FTP ports 20/21
  9. How to Rebuild the “initramfs” with Multipath in CentOS/RHEL 6 and 7
  10. bspc: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • qsub Command Examples in Linux
  • qsub: command not found
  • qrcp Command Examples in Linux
  • qmrestore Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright