sar command is unable to read the sa file from a new path.

Solution Verified - Updated -

Issue

  • The sar command is unable to read the sa[0-9] file from a new path /var/ephemeral/sa.
# cat /etc/sysconfig/sysstat |grep SA_DIR=
#SA_DIR=/var/log/sa
SA_DIR=/var/ephemeral/sa

# ls -l  /var/ephemeral/sa
total 1484644
-rw-r--r-- 1 root root 18947536 Mar  1 23:58 sa01
-rw-r--r-- 1 root root 19069532 Mar  2 23:58 sa02
-rw-r--r-- 1 root root 19069532 Mar  3 23:58 sa03
-rw-r--r-- 1 root root 19069532 Mar  4 23:58 sa04
-rw-r--r-- 1 root root 19069532 Mar  5 23:58 sa05
-rw-r--r-- 1 root root 19069532 Mar  6 23:58 sa06
-rw-r--r-- 1 root root 19069532 Mar  7 23:58 sa07
-rw-r--r-- 1 root root 19069532 Mar  8 23:58 sa08
-rw-r--r-- 1 root root 19069532 Mar  9 23:58 sa09
-rw-r--r-- 1 root root 18275012 Mar 10 23:58 sa10

# sar -u
Linux 4.18.0-425.19.2.el8_7.x86_64 (TEST)   **10/24/2023**      _x86_64_        (192 CPU)

12:00:00 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:00 AM     all      1.00      0.00      0.66      0.03      0.00     98.30
12:20:00 AM     all      0.99      0.00      0.66      0.03      0.00     98.32
12:30:00 AM     all      1.02      0.00      0.68      0.03      0.00     98.28
12:40:00 AM     all      1.04      0.00      0.76      0.03      0.00     98.17
  • The sar -u command still extracts data from the default path, which is /var/log/sa.
# strace -fvttTyy -s 256 -o /tmp/strace.txt sar -u

# grep "read" /tmp/strace.txt | awk '{print $3}' | sort | uniq -c
      1 execve("/usr/bin/sar",
      2 read(3</usr/lib64/libc-2.28.so>,
      2 read(3</usr/share/zoneinfo/Asia/Kolkata>,
   1529 read(3</var/log/sa/sa10>,                            <<< - - - 
      2 read(4</usr/share/locale/locale.alias>,

Environment

  • Red Hat Enterprise Linux
  • sysstat

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content