Page MenuHomeVyOS Platform

Ability to get logs in machine readable format
Needs testing, NormalPublicFEATURE REQUEST

Description

Ability to get logs in a machine-readable format
For example:

sudo journalctl --output json

Options or some of them:
--all - All logs
--boot - all logs since boot
--last x - last x entries
--since - Show entries not older than the specified date
--unit - Show logs from the specified unit
--facility Show entries with the specified facilities
--utc Express time in Coordinated Universal Time (UTC)

Details

Version
1.4
Is it a breaking change?
Unspecified (possibly destroys the router)

Event Timeline

Viacheslav updated the task description. (Show Details)
Viacheslav changed Version from - to 1.4.
Viacheslav changed the task status from Open to In progress.Nov 1 2022, 3:45 PM
Viacheslav claimed this task.
Viacheslav changed the task status from In progress to Needs testing.Nov 2 2022, 2:39 PM

Requires rewriting function show to python-systemd

def show():
    from systemd import journal
    output = journal.Reader()
    return [line for line in output]

Needs to think about how to use arguments with new implementation in systemd-python

root@r14:/home/vyos# /usr/libexec/vyos/op_mode/log.py show --help
usage: log.py show [-h] [--raw] [--boot] [--count COUNT] [--facility FACILITY] [--reverse] [--utc] [--unit UNIT]

optional arguments:
  -h, --help           show this help message and exit
  --raw
  --boot
  --count COUNT
  --facility FACILITY
  --reverse
  --utc
  --unit UNIT
root@r14:/home/vyos#