xref: /openbmc/phosphor-debug-collector/tools/dreport.d/plugins.d/journalpid (revision aa146d624ca2eba1dd2cf986344d30dca894b60e)
1a172469dSJayanth Othayoth#!/bin/bash
2a172469dSJayanth Othayoth#
3a172469dSJayanth Othayoth# config: 13 1
4a172469dSJayanth Othayoth# @brief: Collect user initialized PID specific journal log information.
5a172469dSJayanth Othayoth#
6a172469dSJayanth Othayoth
7a172469dSJayanth Othayoth. $DREPORT_INCLUDE/functions
8a172469dSJayanth Othayoth
9a172469dSJayanth Othayothdesc="Journal pid:$pid log"
10*aa146d62SJayanth Othayoth
11*aa146d62SJayanth Othayothif [ $pid -eq $ZERO ]; then
12*aa146d62SJayanth Othayoth    log_warning "Missing PID, Collecting last 500 journal entries"
13*aa146d62SJayanth Othayoth    file_name="journal.log"
14*aa146d62SJayanth Othayoth    command="journalctl -o verbose -n $JOURNAL_LINE_LIMIT"
15*aa146d62SJayanth Othayothelse
16a172469dSJayanth Othayoth    file_name="journal-pid-$pid.log"
17a172469dSJayanth Othayoth    command="journalctl -o verbose _PID=$pid"
18*aa146d62SJayanth Othayothfi
19a172469dSJayanth Othayoth
20a172469dSJayanth Othayothadd_cmd_output "$command" "$file_name" "$desc"
21