Skip to content

Commit

Permalink
Add container rsyslog.conf to the sys dump (sonic-net#3039)
Browse files Browse the repository at this point in the history
What I did
Added a new directory to generate_dump for collecting any container specific config files etc to the sys dump. For now only the rsyslog.conf is added

How I did it
How to verify it
Run the dump and see if the rsyslogd files are present

root@r-leopard-41:/home/admin# tree -a sonic_dump_r-leopard-41_20230815_013600/dump/container_dumps/
sonic_dump_r-leopard-41_20230815_013600/dump/container_dumps/
├── bgp
│   └── rsyslog.conf
├── database
│   └── rsyslog.conf
├── dhcp_relay
│   └── rsyslog.conf
├── eventd
│   └── rsyslog.conf
├── lldp
│   └── rsyslog.conf
├── mgmt-framework
│   └── rsyslog.conf
├── pmon
│   └── rsyslog.conf
├── radv
│   └── rsyslog.conf
├── snmp
│   └── rsyslog.conf
├── swss
│   └── rsyslog.conf
├── syncd
│   └── rsyslog.conf
├── teamd
│   └── rsyslog.conf
└── telemetry
    └── rsyslog.conf

13 directories, 13 files
  • Loading branch information
vivekrnv authored and StormLiangMS committed Nov 19, 2023
1 parent b5c8c53 commit 24e3ee8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,22 @@ save_dump_state_all_ns() {
done
}

###############################################################################
# Save important files that are present in container storage for better debugging
# Files will be saved under dump/<container_name>/
# Types of Files Saved:
# 1) rsyslogd.conf
###############################################################################
save_container_files() {
trap 'handle_error $? $LINENO' ERR
local CONTAINER_FDUMP="container_dumps"
# Get the running container names
container_names=$(docker ps --format '{{.Names}}' --filter status=running)
for name in $container_names; do
$MKDIR $V -p $LOGDIR/$CONTAINER_FDUMP/$name
copy_from_docker $name "/etc/rsyslog.conf" $LOGDIR/$CONTAINER_FDUMP/$name/rsyslog.conf
done
}

###############################################################################
# Main generate_dump routine
Expand Down Expand Up @@ -1797,6 +1813,8 @@ main() {
wait
save_redis_info &

save_container_files &

if $DEBUG_DUMP
then
save_dump_state_all_ns &
Expand Down

0 comments on commit 24e3ee8

Please sign in to comment.