Skip to content

Conversation

@ric-sysdig
Copy link

Just a quick check if everything is good, do not merge into main

aantonel-sysdig
aantonel-sysdig previously approved these changes Nov 7, 2025
Copy link

@aantonel-sysdig aantonel-sysdig left a comment

Choose a reason for hiding this comment

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

Approving first public release


DEST_DIR=$(pwd)
SYSDIG_SUPPORT_DIR="sysdig-support"
[ ! -d "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}" ] && mkdir -p "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
[ ! -d "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}" ] && mkdir -p "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}"
mkdir -p "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}"

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, this is a quick one and I'll fix it as soon as possible.

SYSDIG_SUPPORT_DIR="sysdig-support"
[ ! -d "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}" ] && mkdir -p "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}"

ACTIVITY_LOG="${DEST_DIR}/${SYSDIG_SUPPORT_DIR}/activity.log"
Copy link
Member

Choose a reason for hiding this comment

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

I would suggest adding the date to the filename

Copy link
Author

Choose a reason for hiding this comment

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

The filename has already the date/time into the content as first row.

export SYSDIG_CS_DIR
export IS_AIRGAPPED

printf "All the data will be saved using the path ${DEST_DIR}/${SYSDIG_SUPPORT_DIR}\n"
Copy link
Member

Choose a reason for hiding this comment

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

printf is ok, but why not just an echo?

Copy link
Author

Choose a reason for hiding this comment

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

Because printf allow a more granular control over the output.

printf "All the data will be saved using the path ${DEST_DIR}/${SYSDIG_SUPPORT_DIR}\n"
log_activity "Data directory set to ${DEST_DIR}/${SYSDIG_SUPPORT_DIR}"

printf "Please put your executable to access your k8s cluster, kubectl or oc\n"
Copy link
Member

Choose a reason for hiding this comment

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

ask to add the context if needed to the command

kubectl --context a.b.c

Copy link
Author

Choose a reason for hiding this comment

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

I'll add that in the README.

if [[ $podName =~ $SYSDIG_NA_PREFIX ]]; then
printf "Collecting log for pod ${podName}\n"
mkdir -p "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}/logs"
$k8sCmd -n "${namespace}" logs "${podName}" -c "${SYSDIG_KSPMA_CONTAINER_NAME}" > /dev/null 2>&1 && \
Copy link
Member

Choose a reason for hiding this comment

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

You should never need quotes for namespace or podName or containerName. Also please be consistent using variables. Always either ${var} or $var

Copy link
Author

Choose a reason for hiding this comment

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

I'll review this and I'll do another round of test, thanks for the heads up.

printf "Collecting log for pod ${podName}\n"
mkdir -p "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}/logs"
$k8sCmd -n "${namespace}" logs "${podName}" > "${DEST_DIR}/${SYSDIG_SUPPORT_DIR}/logs/${podName}.log" 2>/dev/null
if [ $? -eq 0 ]; then
Copy link
Member

Choose a reason for hiding this comment

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

For consistency (and this is only a nit), but you end up with fewer issues with if [[ test ]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants