Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1050 from jodh-intel/collect-script-consider-log-…
Browse files Browse the repository at this point in the history
…level

scripts: Make Collect script consider log levels
  • Loading branch information
Julio Montes authored Mar 8, 2018
2 parents 532740c + 59cd214 commit fb28cb1
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions data/collect-data.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ problem_pattern+="\<impossible\>|"
problem_pattern+="\<impossibly\>|"
problem_pattern+="\<incorrect|"
problem_pattern+="\<invalid\>|"
problem_pattern+="\<level=\"*error\"* |"
problem_pattern+="\<level=\"*fatal\"* |"
problem_pattern+="\<level=\"*panic\"* |"
problem_pattern+="\<level=\"*warning\"* |"
problem_pattern+="\<missing\>|"
problem_pattern+="\<need\>|"
problem_pattern+="\<no.*such.*file\>|"
Expand All @@ -71,7 +75,7 @@ problem_exclude_pattern+=")"
usage()
{
cat <<EOT
Usage: $script_name
Usage: $script_name [options]
Summary: Collect data about an installation of @PROJECT_NAME@.
Expand All @@ -81,6 +85,18 @@ Description: Run this script as root to obtain a markdown-formatted summary
$issue_url
Options:
-h | --help | help : show this usage summary.
-v | --version | version : show program version.
EOT
}

version()
{
cat <<EOT
$script_name version $script_version
EOT
}

Expand Down Expand Up @@ -210,17 +226,10 @@ find_system_journal_problems()
local program="$2"
local unit="$3"

local selector

data_source="system journal"
# select by identifier
local selector="-t"

if [ -n "$unit" ]; then
# select by systemd unit
selector='-u'
else
# select by identifier
selector='-t'
fi
local data_source="system journal"

local problems=$(journalctl -q -o cat -a "$selector" "$program" |\
grep "time=" |\
Expand Down Expand Up @@ -341,6 +350,7 @@ main()
{
case "$1" in
-h|--help|help) usage && exit 0;;
-v|--version|version) version && exit 0;;
esac

[ $(id -u) -eq 0 ] || die "Need to run as root"
Expand Down

0 comments on commit fb28cb1

Please sign in to comment.