Skip to content

Commit

Permalink
[Multi Asic] support of swss.rec and sairedis.rec for multi asic (#6310)
Browse files Browse the repository at this point in the history
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan [email protected]

- Why I did it
This PR has the changes to support having different swss.rec and sairedis.rec for each asic.
The logrotate script is updated as well

- How I did it

Update the orchagent.sh script to use the logfile name options in these PRs(sonic-net/sonic-swss#1546 and sonic-net/sonic-sairedis#747)
In multi asic platforms the record files will be different for each asic, with the format swss.asic{x}.rec and sairedis.asic{x}.rec

Update the logrotate script for multiasic platform .
  • Loading branch information
arlakshm authored and yxieca committed Feb 23, 2021
1 parent d7517a7 commit d7be5a0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
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
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

0 comments on commit d7be5a0

Please sign in to comment.