_journalctl revision a02c5fe7cbad3ca0536286ceab0bde5fb1c0ba13
2d2eda71267231c2526be701fe655db125852c1ffielding#compdef journalctl
f062ed7bd262a37a909dd77ce5fc23b446818823fielding_list_fields() {
f062ed7bd262a37a909dd77ce5fc23b446818823fielding local -a journal_fields
f062ed7bd262a37a909dd77ce5fc23b446818823fielding journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
2d2eda71267231c2526be701fe655db125852c1ffielding ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
2d2eda71267231c2526be701fe655db125852c1ffielding _{P,U,G}ID _COMM _EXE _CMDLINE
2d2eda71267231c2526be701fe655db125852c1ffielding _AUDIT_{SESSION,LOGINUID}
2d2eda71267231c2526be701fe655db125852c1ffielding _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
2d2eda71267231c2526be701fe655db125852c1ffielding _SYSTEMD_USER_UNIT USER_UNIT
2d2eda71267231c2526be701fe655db125852c1ffielding _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
2d2eda71267231c2526be701fe655db125852c1ffielding _KERNEL_{DEVICE,SUBSYSTEM}
2d2eda71267231c2526be701fe655db125852c1ffielding _UDEV_{SYSNAME,DEVNODE,DEVLINK}
2d2eda71267231c2526be701fe655db125852c1ffielding __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
2d2eda71267231c2526be701fe655db125852c1ffielding case $_jrnl_none in
2d2eda71267231c2526be701fe655db125852c1ffielding yes) _values -s '=' 'possible fields' \
2d2eda71267231c2526be701fe655db125852c1ffielding "${journal_fields[@]}:value:_journal_fields ${words[CURRENT]%%=*}" ;;
f062ed7bd262a37a909dd77ce5fc23b446818823fielding *) _describe 'possible fields' journal_fields ;;
f062ed7bd262a37a909dd77ce5fc23b446818823fielding_journal_none() {
f062ed7bd262a37a909dd77ce5fc23b446818823fielding local -a _commands _files _jrnl_none
2d2eda71267231c2526be701fe655db125852c1ffielding # Setting use-cache will slow this down considerably
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _commands=( ${"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _jrnl_none='yes'
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _alternative : \
f062ed7bd262a37a909dd77ce5fc23b446818823fielding 'files:/dev files:_files -W /dev -P /dev/' \
2d2eda71267231c2526be701fe655db125852c1ffielding "commands:commands:($_commands[@])" \
f062ed7bd262a37a909dd77ce5fc23b446818823fielding 'fields:fields:_list_fields'
2d2eda71267231c2526be701fe655db125852c1ffielding_journal_fields() {
f062ed7bd262a37a909dd77ce5fc23b446818823fielding local -a _fields cmd
f062ed7bd262a37a909dd77ce5fc23b446818823fielding cmd=("journalctl" "-F ${@[-1]}" "2>/dev/null" )
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _fields=( ${(f)"$(_call_program fields $cmd[@])"} )
f062ed7bd262a37a909dd77ce5fc23b446818823fielding typeset -U _fields
2d2eda71267231c2526be701fe655db125852c1ffielding _describe 'possible values' _fields
f062ed7bd262a37a909dd77ce5fc23b446818823fielding_journal_boots() {
f062ed7bd262a37a909dd77ce5fc23b446818823fielding local -a _bootid _previousboots
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _bootid=( ${(fao)"$(_call_program bootid "$service -F _BOOT_ID")"} )
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _previousboots=( -{1..${#_bootid}} )
f062ed7bd262a37a909dd77ce5fc23b446818823fielding _alternative : \
2d2eda71267231c2526be701fe655db125852c1ffielding "offsets:boot offsets:(${_previousboots[1,-2]})" \
2d2eda71267231c2526be701fe655db125852c1ffielding "bootid:boot ids:(${_bootid[@]})"
f062ed7bd262a37a909dd77ce5fc23b446818823fielding_arguments -s \
f062ed7bd262a37a909dd77ce5fc23b446818823fielding {-h,--help}'[Show this help]' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--version[Show package version]' \
f062ed7bd262a37a909dd77ce5fc23b446818823fielding '--no-pager[Do not pipe output into a pager]' \
f062ed7bd262a37a909dd77ce5fc23b446818823fielding {-l,--full}'[Show long fields in full]' \
f062ed7bd262a37a909dd77ce5fc23b446818823fielding {-a,--all}'[Show all fields, including long and unprintable]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-f,--follow}'[Follow journal]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-e,--pager-end}'[Jump to the end of the journal in the pager]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-n+,--lines=}'[Number of journal entries to show]:integer' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--no-tail[Show all lines, even in follow mode]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-r,--reverse}'[Reverse output]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-o+,--output=}'[Change journal output mode]:output modes:_sd_outputmodes' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-x,--catalog}'[Show explanatory texts with each log line]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-q,--quiet}"[Don't show privilege warning]" \
2d2eda71267231c2526be701fe655db125852c1ffielding {-m,--merge}'[Show entries from all available journals]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-b+,--boot=}'[Show data only from the specified boot or offset]:boot id or offset:_journal_boots' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--list-boots[List boots ordered by time]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-k,--dmesg}'[Show only kernel messages, Implies -b]' \
2d2eda71267231c2526be701fe655db125852c1ffielding {-u+,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--user-unit=[Show data only from the specified user session unit]:units:_journal_fields USER_UNIT' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb {-p+,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb {-c+,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--after-cursor=[Start showing entries from the location in the journal after the cursor]:cursors:_journal_fields __CURSORS' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--since=[Start showing entries newer or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--until=[Stop showing entries older or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
bd53cb2bf4d77574fd502e1c02d8c3c0d5431967stoddard {-F,--field=}'[List all values a certain field takes]:Fields:_list_fields' \
b4c8a80f7dbfc9b56dbe03bdc28f0b5eb5f23697rbb '--system[Show system and kernel messages]' \
b4c8a80f7dbfc9b56dbe03bdc28f0b5eb5f23697rbb '--user[Show messages from user services]' \
44c46ef733836b32585d135d2d90856e7cfd9929rbb {-D+,--directory=}'[Show journal files from directory]:directories:_directories' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--file=[Operate on specified journal files]:file:_files' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--root=[Operate on catalog hierarchy under specified directory]:directories:_directories' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--new-id128[Generate a new 128 Bit ID]' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--header[Show journal header information]' \
14bea4ba98aabaf554e37165a07123bb05d6736bstoddard '--disk-usage[Show total disk usage]' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--list-catalog[List messages in catalog]' \
9731f9232bddd7dbac757c780b2b1a2a6931dce7stoddard '--dump-catalog[Dump messages in catalog]' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--update-catalog[Update binary catalog database]' \
b0f20a4a26bcfa85724b1c2e5ec6a077f12ef44crbb '--setup-keys[Generate new FSS key pair]' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--force[Force recreation of FSS keys]' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--interval=[Time interval for changing the FSS sealing key]:time interval' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--verify[Verify journal file consistency]' \
2d2eda71267231c2526be701fe655db125852c1ffielding '--verify-key=[Specify FSS verification key]:FSS key' \
2d2eda71267231c2526be701fe655db125852c1ffielding '*::default: _journal_none'