16 lines
491 B
Bash
Executable File
16 lines
491 B
Bash
Executable File
#!/bin/sh
|
|
# system_logs_journald — read systemd journal entries
|
|
set -e
|
|
input=$(cat)
|
|
lines=$(echo "$input" | jq -r '.lines // "30"')
|
|
unit=$(echo "$input" | jq -r '.unit // empty')
|
|
since=$(echo "$input" | jq -r '.since // empty')
|
|
grep_pat=$(echo "$input" | jq -r '.grep // empty')
|
|
|
|
args="--no-pager -n $lines --output=short-iso"
|
|
[ -n "$unit" ] && args="$args -u $unit"
|
|
[ -n "$since" ] && args="$args --since=$since"
|
|
[ -n "$grep_pat" ] && args="$args --grep=$grep_pat"
|
|
|
|
eval journalctl $args
|