Skip to content
jc-rs
GitHub

last

--lastv1.9.0

Converts `last` and `lastb` command output to JSON

LinuxmacOSFreeBSDcommand
$ last | jc-rs --last

A real pair

From the reference corpus (fedora32/last.json). The left pane is the input the fixture ships; the right pane is the corpus's expected JSON. CI compares jc-rs with it field by field under the published differential. Hover a value to see where it came from.

lastfedora32
kbrazil  pts/0        192.168.71.1     Fri May  1 15:25    gone - no logout
kbrazil  tty1                          Fri May  1 15:24    gone - no logout
reboot   system boot  5.6.6-300.fc32.x Fri May  1 15:24   still running
kbrazil  pts/0        192.168.71.1     Thu Apr 30 15:27 - 15:22  (23:55)
kbrazil  tty1                          Thu Apr 30 15:25 - down   (23:57)
reboot   system boot  5.6.6-300.fc32.x Thu Apr 30 15:22 - 15:22 (1+00:00)

wtmp begins Thu Apr 30 15:22:02 2020
expected outputjson
Use the Left and Right arrow keys to highlight the matching value in the input.
[
  {
    "user": "kbrazil",
    "tty": "pts/0",
    "hostname": "192.168.71.1",
    "login": "Fri May 1 15:25",
    "logout": "gone - no logout"
  },
  {
    "user": "kbrazil",
    "tty": "tty1",
    "hostname": null,
    "login": "Fri May 1 15:24",
    "logout": "gone - no logout"
  },
  {
    "user": "reboot",
    "tty": "system boot",
    "hostname": "5.6.6-300.fc32.x",
    "login": "Fri May 1 15:24",
    "logout": "running"
  },
  {
    "user": "kbrazil",
    "tty": "pts/0",
    "hostname": "192.168.71.1",
    "login": "Thu Apr 30 15:27",
    "logout": "15:22",
    "duration": "23:55"
  },
  {
    "user": "kbrazil",
    "tty": "tty1",
    "hostname": null,
    "login": "Thu Apr 30 15:25",
    "logout": "down",
    "duration": "23:57"
  },
  {
    "user": "reboot",
    "tty": "system boot",
    "hostname": "5.6.6-300.fc32.x",
    "login": "Thu Apr 30 15:22",
    "logout": "15:22",
    "duration": "24:00"
  }
]

Fixture coverage

11/11oracle-valid pairs match under the published structural JSON comparison

Magic syntax

jc-rs lastjc-rs runs the command itself and parses what it prints. Recognised for: `last`, `lastb`

Source: crates/jc-rs-parsers/src/system/last.rs. jc-rs targets the schemas defined by the original Python tool. Fixture coverage above is the measured evidence for this parser; test the inputs your pipeline depends on. Compare