Skip to content

Commit

Permalink
csi: add logrotate file to a csi log dir
Browse files Browse the repository at this point in the history
added the csi log to a csi log directory csi_log_${node}

Also updated correct dir path to cllect the ceph daemon logs

closes: red-hat-storage#178

Signed-off-by: parth-gr <[email protected]>
  • Loading branch information
parth-gr committed Jul 11, 2024
1 parent f6d6004 commit 702a614
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions collection-scripts/gather_ceph_logs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ for ns in $namespaces; do
oc rsync -n "${ns}" "$(oc get pods -n "${ns}" --no-headers | grep "${node//./}-debug" | awk '{print $1}')":/host/var/lib/rook/"${ns}"/log "${CEPH_DAEMON_LOG_OUTPUT_DIR}"
}

# Collecting csi and ceph daemon logs
csi_log_collection() {
dbglog "collecting csi and ceph daemon logs from node ${node}"
# as per the correction we are keeping both /var/lib/rook & /var/log/ceph for ceph pods, as to not break anything
oc rsync -n "${ns}" "$(oc get pods -n "${ns}" --no-headers | grep "${node//./}-debug" | awk '{print $1}')":/host/var/log/ceph/ "${CEPH_DAEMON_LOG_OUTPUT_DIR}"
oc rsync -n "${ns}" "$(oc get pods -n "${ns}" --no-headers | grep "${node//./}-debug" | awk '{print $1}')":/host/var/lib/rook/"${ns}".rbd.csi.ceph.com/log "${CSI_LOG_OUTPUT_DIR}"
oc rsync -n "${ns}" "$(oc get pods -n "${ns}" --no-headers | grep "${node//./}-debug" | awk '{print $1}')":/host/var/lib/rook/"${ns}".cephfs.csi.ceph.com/log "${CSI_LOG_OUTPUT_DIR}"
oc rsync -n "${ns}" "$(oc get pods -n "${ns}" --no-headers | grep "${node//./}-debug" | awk '{print $1}')":/host/var/lib/rook/"${ns}".nfs.csi.ceph.com/log "${CSI_LOG_OUTPUT_DIR}"
}

crash_core_collection() {
dbglog "collecting crash core dump from node ${node}"
oc rsync -n "${ns}" "$(oc get pods -n "${ns}" --no-headers | grep "${node//./}"-debug | awk '{print $1}')":/host/var/lib/rook/"${ns}"/crash/ "${CRASH_OUTPUT_DIR}"
Expand Down Expand Up @@ -45,15 +55,18 @@ CMDS
dbglog "collecting crash, journal and volume logs from node ${node}"
CRASH_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/crash_${node}
CEPH_DAEMON_LOG_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/ceph_daemon_log_${node}
CSI_LOG_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/csi_log_${node}
JOURNAL_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/journal_${node}
KERNEL_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/kernel_${node}
COREDUMP_OUTPUT_DIR=${CEPH_COLLECTION_PATH}/coredump_${node}
mkdir -p "${CRASH_OUTPUT_DIR}"
mkdir -p "${CEPH_DAEMON_LOG_OUTPUT_DIR}"
mkdir -p "${CSI_LOG_OUTPUT_DIR}"
mkdir -p "${JOURNAL_OUTPUT_DIR}"
mkdir -p "${KERNEL_OUTPUT_DIR}"
mkdir -p "${COREDUMP_OUTPUT_DIR}"
ceph_daemon_log_collection &
csi_log_collection &
pids_log+=($!)
crash_core_collection &
pids_log+=($!)
Expand Down

0 comments on commit 702a614

Please sign in to comment.