summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayanth Othayoth <ojayanth@in.ibm.com>2018-01-08 06:57:53 -0600
committerJayanth Othayoth <ojayanth@in.ibm.com>2018-01-25 00:43:56 -0600
commitaa146d624ca2eba1dd2cf986344d30dca894b60e (patch)
treed351cc2a090ec631d7082f8dbcce8d4c4c4c9e7b
parentdf4cccfb9cd1112e83b0ffdafb89feb913e7580d (diff)
downloadphosphor-debug-collector-aa146d624ca2eba1dd2cf986344d30dca894b60e.tar.gz
phosphor-debug-collector-aa146d624ca2eba1dd2cf986344d30dca894b60e.zip
dreport: Collect journal log in case PID is not present
dreport uses PID information from the elog or core file to collect PID based journal logs as part the BMC dump. Existing dreport skips journal log collection in case PID information is missing in the elog or core file. Proposed changes help to collect the last 500 journal entries when the PID is not present in the elog entry or core file. Resolves openbmc/openbmc#2716 Change-Id: Ib3d8dfea64ea17f4b020b429267294c36530848b Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
-rwxr-xr-xtools/dreport.d/dreport4
-rw-r--r--tools/dreport.d/plugins.d/journalpid11
2 files changed, 12 insertions, 3 deletions
diff --git a/tools/dreport.d/dreport b/tools/dreport.d/dreport
index c37c193..7fc1c32 100755
--- a/tools/dreport.d/dreport
+++ b/tools/dreport.d/dreport
@@ -51,6 +51,8 @@ declare -rx TIME_STAMP="date -u"
declare -rx PLUGIN="pl_"
declare -rx DREPORT_SOURCE="/usr/share/dreport.d"
declare -rx DREPORT_INCLUDE="$DREPORT_SOURCE/include.d"
+declare -rx ZERO="0"
+declare -rx JOURNAL_LINE_LIMIT="500"
#Error Codes
declare -rx SUCCESS="0"
@@ -70,7 +72,7 @@ declare -x optional_path=""
declare -x dreport_log=""
declare -x summary_log=""
declare -x cur_dump_size=0
-declare -x pid="0"
+declare -x pid=$ZERO
declare -x elog_id=""
#Source dreport common functions
diff --git a/tools/dreport.d/plugins.d/journalpid b/tools/dreport.d/plugins.d/journalpid
index aa6a19a..0481d4d 100644
--- a/tools/dreport.d/plugins.d/journalpid
+++ b/tools/dreport.d/plugins.d/journalpid
@@ -7,7 +7,14 @@
. $DREPORT_INCLUDE/functions
desc="Journal pid:$pid log"
-file_name="journal-pid-$pid.log"
-command="journalctl -o verbose _PID=$pid"
+
+if [ $pid -eq $ZERO ]; then
+ log_warning "Missing PID, Collecting last 500 journal entries"
+ file_name="journal.log"
+ command="journalctl -o verbose -n $JOURNAL_LINE_LIMIT"
+else
+ file_name="journal-pid-$pid.log"
+ command="journalctl -o verbose _PID=$pid"
+fi
add_cmd_output "$command" "$file_name" "$desc"
OpenPOWER on IntegriCloud