Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dockers/docker-orchagent/orchagent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ then
ORCHAGENT_ARGS+="-i $asic_id "
fi

# for multi asic platforms add the asic name to the record file names
if [[ "$NAMESPACE_ID" ]]; then
ORCHAGENT_ARGS+="-f swss.asic$NAMESPACE_ID.rec -j sairedis.asic$NAMESPACE_ID.rec "
fi

# Add platform specific arguments if necessary
if [ "$platform" == "broadcom" ]; then
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
Expand Down
21 changes: 18 additions & 3 deletions files/image_config/logrotate/logrotate.d/rsyslog
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
/var/log/telemetry.log
/var/log/frr/bgpd.log
/var/log/frr/zebra.log
/var/log/swss/sairedis.rec
/var/log/swss/swss.rec
/var/log/swss/sairedis*.rec
/var/log/swss/swss*.rec
{
size 1M
rotate 5000
Expand Down Expand Up @@ -85,7 +85,22 @@
endscript
postrotate
if [ $(echo $1 | grep -c "/var/log/swss/") -gt 0 ]; then
pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true
# for multi asic platforms, there are multiple orchagents
# send the SIGHUP only to the orchagent the which needs log file rotation
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf
if [ -f "$ASIC_CONF" ]; then
. $ASIC_CONF
fi
if [ $NUM_ASIC -gt 1 ]; then
log_file=$1
log_file_name=${log_file#/var/log/swss/}
logger -p syslog.info -t "logrotate" "Sending SIGHUP to OA log_file_name: $log_file_name"
pgrep -xa orchagent | grep $log_file_name | awk '{ print $1; }' | xargs /bin/kill -HUP 2>/dev/null || true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the pgrep -xa orchagent looks like on a multi-asic platform? can you provide output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

admin@sonic:/var/log/swss$ pgrep -xa orchagent
11710 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 03:00.0 -f swss.asic0.rec -j sairedis.asic0.rec -m 00:be:75:3a:ef:50
12159 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 04:00.0 -f swss.asic1.rec -j sairedis.asic1.rec -m 00:be:75:3a:ef:50
12168 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 08:00.0 -f swss.asic4.rec -j sairedis.asic4.rec -m 02:42:f0:7f:01:06
12169 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 09:00.0 -f swss.asic5.rec -j sairedis.asic5.rec -m 02:42:f0:7f:01:02
12205 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 05:00.0 -f swss.asic2.rec -j sairedis.asic2.rec -m 00:be:75:3a:ef:50
12236 /usr/bin/orchagent -d /var/log/swss -b 8192 -i 06:00.0 -f swss.asic3.rec -j sairedis.asic3.rec -m 00:be:75:3a:ef:50

else
logger -p syslog.info -t "logrotate" "Sending SIGHUP to OA log_file_name: $1"
pgrep -x orchagent | xargs /bin/kill -HUP 2>/dev/null || true
fi
else
/bin/kill -HUP $(cat /var/run/rsyslogd.pid)
fi
Expand Down