Skip to content

Commit

Permalink
If rsyslog not installed collect more from journalctl issue#120
Browse files Browse the repository at this point in the history
  • Loading branch information
g23guy committed Oct 7, 2022
1 parent 7e0d53b commit 641910f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 42 deletions.
86 changes: 45 additions & 41 deletions bin/supportconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

SVER='3.1.11-30.1_dev8'
SVER='3.1.11-30.1_dev9'
SDATE='2022 10 07'

##############################################################################
Expand Down Expand Up @@ -524,53 +524,57 @@ messages_file() {
test $MIN_OPTION_SYSLOGS -eq 0 && { echolog EXCLUDED; return 1; }
OF=messages.txt
addHeaderFile $OF
if [[ $ADD_OPTION_LOGS -gt 0 ]]; then
FILES="$(ls -1 /var/log/messages-[[:digit:]]* 2>/dev/null)"
[[ -n "$FILES" ]] && log_entry $OF note "Additional Rotated Logs Included in the Tar Ball"
log_files $OF 0 /var/log/messages
for CMPLOG in $FILES
do
FILE=$(basename $CMPLOG)
FILEROOT=${LOG}/$(cut -d\. -f1 <<< ${FILE})
cp $CMPLOG ${LOG}
FILE_TYPE=$(file --brief --mime-type $CMPLOG 2>/dev/null)
case $FILE_TYPE in
"text/plain")
;;
"application/x-xz")
wait_trace_on "xz -d ${LOG}/$FILE"
xz -d ${LOG}/$FILE
;;
"application/x-bzip2")
wait_trace_on "bzip2 -d ${LOG}/$FILE"
bzip2 -d ${LOG}/$FILE
;;
"application/x-gzip")
wait_trace_on "gzip -d ${LOG}/$FILE"
gzip -d ${LOG}/$FILE
;;
*)
continue
;;
esac
mv ${FILEROOT} ${FILEROOT}.txt
wait_trace_off
done
else
LOGFILE="/var/log/messages"
if [[ -e $LOGFILE ]]; then
MESSAGES_FILE="/var/log/messages"
if [[ -s $MESSAGES_FILE ]]; then
if [[ $ADD_OPTION_LOGS -gt 0 ]]; then
FILES="$(ls -1 /var/log/messages-[[:digit:]]* 2>/dev/null)"
[[ -n "$FILES" ]] && log_entry $OF note "Additional Rotated Logs Included in the Tar Ball"
log_files $OF 0 /var/log/messages
for CMPLOG in $FILES
do
FILE=$(basename $CMPLOG)
FILEROOT=${LOG}/$(cut -d\. -f1 <<< ${FILE})
cp $CMPLOG ${LOG}
FILE_TYPE=$(file --brief --mime-type $CMPLOG 2>/dev/null)
case $FILE_TYPE in
"text/plain")
;;
"application/x-xz")
wait_trace_on "xz -d ${LOG}/$FILE"
xz -d ${LOG}/$FILE
;;
"application/x-bzip2")
wait_trace_on "bzip2 -d ${LOG}/$FILE"
bzip2 -d ${LOG}/$FILE
;;
"application/x-gzip")
wait_trace_on "gzip -d ${LOG}/$FILE"
gzip -d ${LOG}/$FILE
;;
*)
continue
;;
esac
mv ${FILEROOT} ${FILEROOT}.txt
wait_trace_off
done
else
if [[ $VAR_OPTION_MSG_MAXSIZE -eq 0 ]]; then
log_files $OF 0 $LOGFILE # override and get the entire file
log_files $OF 0 $MESSAGES_FILE # override and get the entire file
else
MSGSIZE=$(stat -c%s $LOGFILE)
MSGSIZE=$(stat -c%s $MESSAGES_FILE)
if [[ $MSGSIZE -gt $VAR_OPTION_MSG_MAXSIZE ]]; then
log_files $OF $VAR_OPTION_MSG_LINE_COUNT $LOGFILE # the file exceeded the max size allowed, get specified lines of the file
log_files $OF $VAR_OPTION_MSG_LINE_COUNT $MESSAGES_FILE # the file exceeded the max size allowed, get specified lines of the file
else
log_files $OF 0 $LOGFILE # get the whole file
log_files $OF 0 $MESSAGES_FILE # get the whole file
fi
fi
fi
else
if (( $ADD_OPTION_LOGS > 0 )); then
log_cmd $OF "journalctl --no-pager --output=short-iso"
else
log_cmd $OF "journalctl --no-pager --lines $VAR_OPTION_MSG_LINE_COUNT"
log_cmd $OF "journalctl --no-pager --output=short-iso --lines $VAR_OPTION_MSG_LINE_COUNT"
fi
fi
echolog Done
Expand Down
3 changes: 2 additions & 1 deletion spec/supportutils.changes
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
-------------------------------------------------------------------
Fri Oct 7 18:04:34 UTC 2022 - jason.record@suse.com
Fri Oct 7 19:31:16 UTC 2022 - jason.record@suse.com

- Changes to version 3.1.21
+ If rsyslog not installed collect more from journalctl (issue#120)
+ Added systemd-status.txt for the status of all service units (issue#125)
+ autofs includes files in (+dir:<path>) (issue#111)
+ Get current sar data before collecting files (bsc#1192648)
Expand Down

0 comments on commit 641910f

Please sign in to comment.