Skip to content

Commit 2c5a8f3

Browse files
fmountclaude
andcommitted
Add SOS_JOURNAL_SIZE parameter to limit journal collection size
Introduces a new SOS_JOURNAL_SIZE environment variable that allows users to limit the size of collected journals in MiB for EDPM SOS reports. This helps control storage usage when gathering large amounts of journal data from EDPM nodes. Co-Authored-By: Claude <[email protected]> Signed-off-by: Francesco Pantano <[email protected]>
1 parent 748dff8 commit 2c5a8f3

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ This is the list of available environmental variables:
5858
- `SOS_EDPM_PROFILES`: List of sos report profiles to use. Empty string to run
5959
them all. Defaults to: `container,openstack_edpm,system,storage,virt`
6060
- `SOS_EDPM_PLUGINS`: List of sos report plugins to use. This is optional.
61+
- `SOS_EDPM_JOURNAL_SIZE`: Limit the size of collected journals in MiB. Must be
62+
a positive integer. If not set or invalid, journal size limiting is ignored.
6163
- `OPENSTACK_DATABASES`: comma separated list of OpenStack databases that should
6264
be dumped. It is possible to set it to `ALL` and dump all databases. By default
6365
this env var is unset, hence the database dump is skipped.

collection-scripts/gather_edpm_sos

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# plugins in the list are run.
1313
# SOS_DECOMPRESS: bool to disable decompressing sos reports. Set to 0 to disable
1414
# or set to 1 to enable. Defaults to 1
15-
#
15+
# SOS_EDPM_JOURNAL_SIZE: Limit the size of collected journals in MiB. Must be
16+
# a positive integer. If not set or invalid, journal
17+
# size limiting is ignored.
1618

1719
# When called from the shell directly
1820
if [[ -z "$DIR_NAME" ]]; then
@@ -32,6 +34,15 @@ else
3234
IFS=',' read -r -a SOS_EDPM <<< "$SOS_EDPM"
3335
fi
3436

37+
# --journal-size: Limit the size of collected journals in MiB
38+
if [[ -z "$SOS_EDPM_JOURNAL_SIZE" || ! "$SOS_EDPM_JOURNAL_SIZE" =~ ^[0-9]+$ ]]; then
39+
echo "Journal size limit not set or invalid: ignoring"
40+
SOS_JOURNAL=""
41+
else
42+
echo "Setting journal size limit to ${SOS_EDPM_JOURNAL_SIZE} MiB"
43+
SOS_JOURNAL="--journal-size $SOS_EDPM_JOURNAL_SIZE"
44+
fi
45+
3546
# Default to some profiles if SOS_EDPM_PROFILES is not set
3647
SOS_EDPM_PROFILES="${SOS_EDPM_PROFILES-container,openstack_edpm,system,storage,virt}"
3748
if [[ -n "$SOS_EDPM_PROFILES" ]]; then
@@ -67,7 +78,7 @@ gather_edpm_sos () {
6778
done
6879
fi
6980

70-
SSH sudo "bash -c \"rm -rf $TMPDIR && mkdir $TMPDIR && sos report --batch --all-logs --tmp-dir=$TMPDIR $SOS_LIMIT\""
81+
SSH sudo "bash -c \"rm -rf $TMPDIR && mkdir $TMPDIR && sos report --batch --all-logs --tmp-dir=$TMPDIR $SOS_JOURNAL $SOS_LIMIT\""
7182
# shellcheck disable=SC2181
7283
if [ $? -ne 0 ]; then
7384
echo "Failed to run sos report on ${node}, won't retrieve data"

0 commit comments

Comments
 (0)