1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-07-13 01:20:24 +02:00

add fixes and tests for entries that contain 'crash'

This commit is contained in:
Kelly Brazil
2021-01-05 15:16:40 -08:00
parent 2b7405c5e2
commit 7351c72e45
6 changed files with 402 additions and 1 deletions

View File

@ -194,9 +194,17 @@ def parse(data, raw=False, quiet=False):
if re.match(r'\d\d:\d\d:\d\d \d\d\d\d', ' '.join(linedata[6:8])):
output_line['login'] = ' '.join(linedata[3:8])
if len(linedata) > 9:
if len(linedata) > 9 and linedata[9] != 'crash':
output_line['logout'] = ' '.join(linedata[9:14])
if len(linedata) > 9 and linedata[9] == 'crash':
output_line['logout'] = linedata[9]
# add more items to the list to line up duration
linedata.insert(10, '-')
linedata.insert(10, '-')
linedata.insert(10, '-')
linedata.insert(10, '-')
if len(linedata) > 14:
output_line['duration'] = linedata[14].replace('(', '').replace(')', '')

File diff suppressed because one or more lines are too long

184
tests/fixtures/centos-7.7/last-crash.out vendored Normal file
View File

@ -0,0 +1,184 @@
kbrazil pts/0 kbrazil-mac.attl Tue Jan 5 14:29 still logged in
kbrazil tty1 Tue Jan 5 14:28 still logged in
reboot system boot 3.10.0-1062.1.2. Tue Jan 5 14:28 - 14:35 (00:07)
kbrazil tty1 Mon Jan 4 12:29 - crash (1+01:59)
reboot system boot 3.10.0-1062.1.2. Mon Jan 4 12:11 - 14:35 (1+02:24)
kbrazil pts/0 kbrazil-mac.attl Wed Dec 30 11:12 - crash (5+00:58)
reboot system boot 3.10.0-1062.1.2. Wed Dec 30 10:59 - 14:35 (6+03:35)
kbrazil pts/0 kbrazil-mac.attl Tue Dec 29 10:14 - crash (1+00:45)
kbrazil tty1 Tue Dec 29 10:11 - crash (1+00:48)
reboot system boot 3.10.0-1062.1.2. Tue Dec 29 10:11 - 14:35 (7+04:24)
kbrazil pts/0 kbrazil-mac.attl Wed Aug 12 15:21 - crash (138+19:49)
kbrazil tty1 Wed Aug 12 15:08 - crash (138+20:03)
reboot system boot 3.10.0-1062.1.2. Wed Aug 12 15:07 - 14:35 (146+00:28)
kbrazil pts/0 kbrazil-mac.attl Tue Aug 4 09:39 - crash (8+05:27)
kbrazil tty1 Tue Aug 4 09:39 - crash (8+05:28)
reboot system boot 3.10.0-1062.1.2. Tue Aug 4 09:30 - 14:35 (154+06:05)
kbrazil pts/0 kbrazil-mac.attl Sat Aug 1 08:58 - crash (3+00:32)
kbrazil tty1 Fri Jul 31 13:55 - crash (3+19:34)
reboot system boot 3.10.0-1062.1.2. Fri Jul 31 13:55 - 14:35 (158+01:40)
kbrazil pts/0 kbrazil-mac.attl Thu Jul 30 08:34 - crash (1+05:21)
kbrazil tty1 Thu Jul 30 08:31 - crash (1+05:24)
reboot system boot 3.10.0-1062.1.2. Thu Jul 30 08:31 - 14:35 (159+07:04)
kbrazil pts/0 kbrazil-mac.attl Tue Jul 28 19:23 - crash (1+13:07)
kbrazil tty1 Tue Jul 28 19:23 - crash (1+13:07)
reboot system boot 3.10.0-1062.1.2. Tue Jul 28 19:22 - 14:35 (160+20:13)
kbrazil pts/0 kbrazil-mac.attl Tue Jul 28 16:27 - crash (02:54)
kbrazil tty1 Tue Jul 28 16:27 - crash (02:55)
reboot system boot 3.10.0-1062.1.2. Tue Jul 28 13:22 - 14:35 (161+02:13)
kbrazil pts/0 kbrazil-mac.attl Tue Jul 28 00:13 - crash (13:08)
kbrazil pts/0 kbrazil-mac.attl Mon Jul 27 20:23 - 00:13 (03:49)
kbrazil tty1 Mon Jul 27 20:23 - crash (16:59)
reboot system boot 3.10.0-1062.1.2. Mon Jul 27 20:04 - 14:35 (161+19:31)
kbrazil pts/0 kbrazil-mac.attl Tue Jul 21 09:15 - crash (6+10:49)
kbrazil tty1 Tue Jul 21 09:15 - crash (6+10:49)
reboot system boot 3.10.0-1062.1.2. Tue Jul 21 09:14 - 14:35 (168+06:21)
kbrazil pts/1 kbrazil-mac.attl Fri Jul 17 19:12 - 19:13 (00:00)
kbrazil pts/0 192.168.71.1 Fri Jul 17 15:49 - crash (3+17:25)
kbrazil tty1 Fri Jul 17 15:48 - crash (3+17:26)
reboot system boot 3.10.0-1062.1.2. Fri Jul 17 15:48 - 14:35 (171+23:47)
kbrazil pts/0 kbrazil-mac.attl Fri Jul 17 01:52 - crash (13:56)
kbrazil pts/1 192.168.71.1 Thu Jul 16 14:48 - crash (1+00:59)
kbrazil pts/0 192.168.71.1 Thu Jul 16 14:10 - 16:26 (02:15)
kbrazil tty1 Thu Jul 16 14:09 - crash (1+01:38)
reboot system boot 3.10.0-1062.1.2. Thu Jul 16 08:35 - 14:35 (173+07:00)
kbrazil ttyS0 Wed Jul 8 13:44 - crash (7+18:50)
kbrazil tty1 Wed Jul 8 13:12 - crash (7+19:22)
reboot system boot 3.10.0-1062.1.2. Wed Jul 8 11:27 - 14:35 (181+04:08)
kbrazil ttyS0 Fri Jun 26 11:53 - crash (11+23:33)
reboot system boot 3.10.0-1062.1.2. Fri Jun 26 11:52 - 14:35 (193+03:43)
kbrazil ttyS0 Tue Jun 23 15:23 - 15:27 (00:03)
reboot system boot 3.10.0-1062.1.2. Tue Jun 23 15:23 - 15:27 (00:04)
kbrazil pts/0 192.168.71.1 Fri Jun 19 10:47 - crash (4+04:36)
kbrazil tty1 Fri Jun 19 10:46 - crash (4+04:36)
reboot system boot 3.10.0-1062.1.2. Fri Jun 19 10:29 - 15:27 (4+04:58)
kbrazil pts/0 192.168.71.1 Mon Jun 8 10:30 - crash (10+23:58)
kbrazil tty1 Mon Jun 8 10:30 - crash (10+23:58)
reboot system boot 3.10.0-1062.1.2. Mon Jun 8 10:30 - 15:27 (15+04:57)
reboot system boot 3.10.0-1062.1.2. Tue Jun 2 12:05 - 15:27 (21+03:21)
kbrazil pts/0 192.168.71.1 Tue Jun 2 08:38 - crash (03:26)
kbrazil tty1 Tue Jun 2 08:38 - crash (03:27)
reboot system boot 3.10.0-1062.1.2. Tue Jun 2 06:13 - 15:27 (21+09:13)
kbrazil pts/0 192.168.71.1 Sun May 24 16:10 - 17:18 (01:08)
kbrazil tty1 Sun May 24 15:34 - crash (8+14:39)
reboot system boot 3.10.0-1062.1.2. Sun May 24 15:34 - 15:27 (29+23:53)
kbrazil pts/1 192.168.71.1 Fri May 22 13:39 - crash (2+01:54)
kbrazil pts/0 192.168.71.1 Fri May 22 13:11 - crash (2+02:22)
kbrazil tty1 Fri May 22 13:10 - crash (2+02:23)
reboot system boot 3.10.0-1062.1.2. Fri May 22 12:49 - 15:27 (32+02:37)
kbrazil pts/0 192.168.71.1 Fri May 22 08:44 - crash (04:05)
kbrazil tty1 Fri May 22 08:44 - crash (04:05)
reboot system boot 3.10.0-1062.1.2. Fri May 22 08:43 - 15:27 (32+06:43)
kbrazil tty1 Thu May 14 16:39 - crash (7+16:04)
reboot system boot 3.10.0-1062.1.2. Thu May 14 16:39 - 15:27 (39+22:48)
kbrazil pts/0 192.168.71.1 Wed May 13 10:23 - crash (1+06:15)
kbrazil tty1 Wed May 13 10:22 - crash (1+06:16)
reboot system boot 3.10.0-1062.1.2. Wed May 13 09:51 - 15:27 (41+05:35)
kbrazil pts/1 192.168.71.1 Wed Apr 15 13:00 - crash (27+20:51)
kbrazil pts/0 192.168.71.1 Wed Apr 15 12:38 - 13:01 (00:22)
kbrazil tty1 Wed Apr 15 12:28 - 20:44 (08:15)
reboot system boot 3.10.0-1062.1.2. Wed Apr 15 04:02 - 15:27 (69+11:25)
kbrazil ttyS0 Tue Apr 14 16:02 - crash (11:59)
reboot system boot 3.10.0-1062.1.2. Tue Apr 14 16:02 - 15:27 (69+23:25)
kbrazil ttyS0 Tue Apr 14 08:44 - 10:00 (01:16)
kbrazil ttyS0 Tue Apr 14 06:57 - 08:44 (01:47)
reboot system boot 3.10.0-1062.1.2. Tue Apr 14 06:56 - 15:27 (70+08:31)
kbrazil tty1 Tue Apr 7 17:33 - crash (6+13:22)
kbrazil tty1 Mon Apr 6 21:22 - 22:42 (01:19)
kbrazil tty1 Mon Apr 6 19:43 - 19:45 (00:01)
kbrazil ttyS0 Sat Apr 4 17:31 - crash (9+13:24)
reboot system boot 3.10.0-1062.1.2. Sat Apr 4 17:17 - 15:27 (79+22:10)
kbrazil ttyS0 Sun Mar 29 12:42 - crash (6+04:34)
kbrazil ttyS0 Tue Mar 24 11:21 - 12:42 (5+01:20)
kbrazil ttyS0 Tue Mar 24 11:18 - 11:21 (00:03)
reboot system boot 3.10.0-1062.1.2. Tue Mar 24 10:57 - 15:27 (91+04:30)
kbrazil ttyS0 Tue Mar 17 06:56 - crash (7+04:00)
reboot system boot 3.10.0-1062.1.2. Tue Mar 17 05:12 - 15:27 (98+10:15)
kbrazil ttyS0 Thu Mar 12 10:12 - crash (4+18:59)
reboot system boot 3.10.0-1062.1.2. Thu Mar 12 09:22 - 15:27 (103+06:05)
kbrazil ttyS0 Wed Mar 11 13:29 - crash (19:52)
reboot system boot 3.10.0-1062.1.2. Wed Mar 11 12:19 - 15:27 (104+03:07)
kbrazil ttyS0 Tue Mar 10 17:53 - crash (18:26)
reboot system boot 3.10.0-1062.1.2. Tue Mar 10 17:52 - 15:27 (104+21:34)
kbrazil ttyS0 Tue Mar 10 13:09 - crash (04:43)
reboot system boot 3.10.0-1062.1.2. Tue Mar 10 13:08 - 15:27 (105+02:18)
kbrazil ttyS0 Sat Mar 7 18:13 - crash (2+17:55)
reboot system boot 3.10.0-1062.1.2. Sat Mar 7 18:13 - 15:27 (107+20:14)
kbrazil ttyS0 Thu Mar 5 14:48 - crash (2+03:24)
reboot system boot 3.10.0-1062.1.2. Thu Mar 5 03:02 - 15:27 (110+11:25)
kbrazil ttyS0 Mon Mar 2 19:53 - crash (2+07:08)
reboot system boot 3.10.0-1062.1.2. Mon Mar 2 19:53 - 15:27 (112+18:34)
kbrazil pts/0 192.168.71.1 Sat Feb 29 18:43 - crash (2+01:09)
kbrazil pts/1 192.168.71.1 Sat Feb 29 18:08 - 18:28 (00:20)
kbrazil pts/0 192.168.71.1 Sat Feb 29 15:16 - 18:42 (03:26)
kbrazil ttyS0 Sat Feb 29 12:14 - crash (2+07:38)
reboot system boot 3.10.0-1062.1.2. Sat Feb 29 12:13 - 15:27 (115+02:13)
kbrazil ttyS0 Fri Feb 28 13:49 - crash (22:23)
reboot system boot 3.10.0-1062.1.2. Fri Feb 28 12:56 - 15:27 (116+01:31)
kbrazil ttyS0 Thu Feb 27 16:01 - crash (20:54)
reboot system boot 3.10.0-1062.1.2. Thu Feb 27 15:51 - 15:27 (116+22:35)
kbrazil ttyS0 Thu Feb 27 10:50 - crash (05:01)
reboot system boot 3.10.0-1062.1.2. Wed Feb 26 20:05 - 15:27 (117+18:22)
kbrazil ttyS0 Thu Feb 20 14:42 - crash (6+05:23)
reboot system boot 3.10.0-1062.1.2. Thu Feb 20 14:41 - 15:27 (123+23:45)
kbrazil ttyS0 Mon Feb 17 17:48 - crash (2+20:52)
reboot system boot 3.10.0-1062.1.2. Mon Feb 17 17:48 - 15:27 (126+20:38)
kbrazil ttyS0 Thu Feb 13 16:44 - crash (4+01:03)
reboot system boot 3.10.0-1062.1.2. Thu Feb 13 16:44 - 15:27 (130+21:42)
kbrazil ttyS0 Wed Feb 5 14:23 - crash (8+02:20)
reboot system boot 3.10.0-1062.1.2. Wed Feb 5 11:43 - 15:27 (139+02:44)
kbrazil ttyS0 Tue Feb 4 14:28 - crash (21:15)
reboot system boot 3.10.0-1062.1.2. Tue Feb 4 01:28 - 15:27 (140+12:59)
kbrazil ttyS0 Mon Jan 13 17:28 - crash (21+07:59)
reboot system boot 3.10.0-1062.1.2. Mon Jan 13 16:16 - 15:27 (161+22:11)
kbrazil ttyS0 Mon Dec 16 11:15 - crash (28+05:01)
reboot system boot 3.10.0-1062.1.2. Mon Dec 16 11:14 - 15:27 (190+03:12)
kbrazil ttyS0 Wed Dec 4 21:41 - crash (11+13:33)
reboot system boot 3.10.0-1062.1.2. Wed Dec 4 21:40 - 15:27 (201+16:46)
kbrazil pts/1 Sat Nov 16 14:40 - 14:40 (00:00)
kbrazil pts/1 Sat Nov 16 14:39 - 14:39 (00:00)
kbrazil pts/0 localhost Tue Nov 12 07:19 - crash (22+14:21)
kbrazil ttyS0 Tue Nov 12 07:18 - crash (22+14:22)
kbrazil pts/0 localhost Sun Nov 10 08:21 - 15:22 (1+07:01)
kbrazil ttyS0 Sat Nov 9 10:34 - 07:16 (2+20:42)
reboot system boot 3.10.0-1062.1.2. Sat Nov 9 10:34 - 15:27 (227+03:53)
kbrazil tty1 Fri Nov 8 07:49 - crash (1+02:45)
kbrazil pts/0 192.168.71.1 Fri Nov 8 06:29 - crash (1+04:04)
kbrazil ttyS0 Fri Nov 8 06:24 - crash (1+04:09)
reboot system boot 3.10.0-1062.1.2. Fri Nov 8 06:14 - 15:27 (228+08:13)
kbrazil tty1 Sun Nov 3 12:20 - crash (4+17:54)
kbrazil ttyS0 Sun Nov 3 11:04 - 11:05 (00:01)
kbrazil pts/0 192.168.71.1 Sat Nov 2 19:26 - crash (5+11:47)
kbrazil ttyS0 Fri Nov 1 15:14 - 11:03 (1+20:49)
reboot system boot 3.10.0-1062.1.2. Fri Nov 1 15:13 - 15:27 (235+00:14)
kbrazil ttyS0 Fri Nov 1 11:16 - 11:36 (00:20)
reboot system boot 3.10.0-1062.1.2. Fri Nov 1 06:00 - 11:36 (05:36)
kbrazil ttyS0 Tue Oct 29 18:17 - crash (2+11:43)
reboot system boot 3.10.0-1062.1.2. Tue Oct 29 18:16 - 11:36 (2+17:19)
kbrazil pts/0 192.168.71.1 Sat Oct 26 09:53 - 15:13 (05:19)
kbrazil ttyS0 Fri Oct 25 18:22 - crash (3+23:54)
reboot system boot 3.10.0-1062.1.2. Fri Oct 25 18:21 - 11:36 (6+17:14)
kbrazil ttyS0 Fri Oct 25 17:14 - 18:21 (01:06)
reboot system boot 3.10.0-1062.1.2. Fri Oct 25 17:13 - 11:36 (6+18:22)
kbrazil ttyS0 Fri Oct 25 15:43 - 17:13 (01:29)
reboot system boot 3.10.0-1062.1.2. Fri Oct 25 13:29 - 17:13 (03:44)
kbrazil ttyS0 Mon Oct 21 13:19 - 19:22 (2+06:03)
reboot system boot 3.10.0-1062.1.2. Mon Oct 21 13:17 - 19:22 (2+06:05)
kbrazil ttyS0 Wed Oct 16 03:23 - crash (5+09:54)
kbrazil ttyS0 Tue Oct 15 16:49 - 03:23 (10:34)
kbrazil ttyS0 Tue Oct 15 10:39 - 16:48 (06:09)
reboot system boot 3.10.0-957.27.2. Tue Oct 15 10:39 - 19:22 (8+08:43)
kbrazil ttyS0 Thu Aug 15 16:05 - 16:05 (00:00)
reboot system boot 3.10.0-957.27.2. Thu Aug 15 16:05 - 16:05 (00:00)
reboot system boot 3.10.0-957.27.2. Thu Aug 15 16:00 - 16:05 (00:05)
kbrazil ttyS0 Thu Aug 15 14:25 - crash (01:35)
reboot system boot 3.10.0-957.27.2. Thu Aug 15 14:24 - 16:05 (01:41)
kbrazil ttyS0 Thu Aug 15 11:58 - crash (02:25)
reboot system boot 3.10.0-957.el7.x Thu Aug 15 11:58 - 16:05 (04:07)
kbrazil ttyS0 Thu Aug 15 11:57 - 11:57 (00:00)
reboot system boot 3.10.0-957.el7.x Thu Aug 15 11:57 - 16:05 (04:08)
kbrazil pts/0 192.168.71.1 Thu Aug 15 10:58 - 11:56 (00:58)
root tty1 Thu Aug 15 10:57 - 11:56 (00:59)
reboot system boot 3.10.0-957.el7.x Thu Aug 15 10:57 - 11:56 (00:59)
wtmp begins Thu Aug 15 10:57:06 2019

File diff suppressed because one or more lines are too long

184
tests/fixtures/centos-7.7/last-wF.out vendored Normal file
View File

@ -0,0 +1,184 @@
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Jan 5 14:29:24 2021 still logged in
kbrazil tty1 Tue Jan 5 14:28:41 2021 still logged in
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jan 5 14:28:28 2021 - Tue Jan 5 14:29:36 2021 (00:01)
kbrazil tty1 Mon Jan 4 12:29:04 2021 - crash (1+01:59)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Jan 4 12:11:44 2021 - Tue Jan 5 14:29:36 2021 (1+02:17)
kbrazil pts/0 kbrazil-mac.attlocal.net Wed Dec 30 11:12:50 2020 - crash (5+00:58)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Dec 30 10:59:51 2020 - Tue Jan 5 14:29:36 2021 (6+03:29)
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Dec 29 10:14:19 2020 - crash (1+00:45)
kbrazil tty1 Tue Dec 29 10:11:44 2020 - crash (1+00:48)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Dec 29 10:11:28 2020 - Tue Jan 5 14:29:36 2021 (7+04:18)
kbrazil pts/0 kbrazil-mac.attlocal.net Wed Aug 12 15:21:36 2020 - crash (138+19:49)
kbrazil tty1 Wed Aug 12 15:08:20 2020 - crash (138+20:03)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Aug 12 15:07:27 2020 - Tue Jan 5 14:29:36 2021 (146+00:22)
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Aug 4 09:39:30 2020 - crash (8+05:27)
kbrazil tty1 Tue Aug 4 09:39:01 2020 - crash (8+05:28)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Aug 4 09:30:24 2020 - Tue Jan 5 14:29:36 2021 (154+05:59)
kbrazil pts/0 kbrazil-mac.attlocal.net Sat Aug 1 08:58:14 2020 - crash (3+00:32)
kbrazil tty1 Fri Jul 31 13:55:56 2020 - crash (3+19:34)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Jul 31 13:55:35 2020 - Tue Jan 5 14:29:36 2021 (158+01:34)
kbrazil pts/0 kbrazil-mac.attlocal.net Thu Jul 30 08:34:03 2020 - crash (1+05:21)
kbrazil tty1 Thu Jul 30 08:31:17 2020 - crash (1+05:24)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Jul 30 08:31:03 2020 - Tue Jan 5 14:29:36 2021 (159+06:58)
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Jul 28 19:23:39 2020 - crash (1+13:07)
kbrazil tty1 Tue Jul 28 19:23:23 2020 - crash (1+13:07)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jul 28 19:22:40 2020 - Tue Jan 5 14:29:36 2021 (160+20:06)
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Jul 28 16:27:59 2020 - crash (02:54)
kbrazil tty1 Tue Jul 28 16:27:26 2020 - crash (02:55)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jul 28 13:22:23 2020 - Tue Jan 5 14:29:36 2021 (161+02:07)
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Jul 28 00:13:44 2020 - crash (13:08)
kbrazil pts/0 kbrazil-mac.attlocal.net Mon Jul 27 20:23:44 2020 - Tue Jul 28 00:13:35 2020 (03:49)
kbrazil tty1 Mon Jul 27 20:23:17 2020 - crash (16:59)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Jul 27 20:04:44 2020 - Tue Jan 5 14:29:36 2021 (161+19:24)
kbrazil pts/0 kbrazil-mac.attlocal.net Tue Jul 21 09:15:29 2020 - crash (6+10:49)
kbrazil tty1 Tue Jul 21 09:15:07 2020 - crash (6+10:49)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jul 21 09:14:38 2020 - Tue Jan 5 14:29:36 2021 (168+06:14)
kbrazil pts/1 kbrazil-mac.attlocal.net Fri Jul 17 19:12:43 2020 - Fri Jul 17 19:13:04 2020 (00:00)
kbrazil pts/0 192.168.71.1 Fri Jul 17 15:49:03 2020 - crash (3+17:25)
kbrazil tty1 Fri Jul 17 15:48:35 2020 - crash (3+17:26)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Jul 17 15:48:11 2020 - Tue Jan 5 14:29:36 2021 (171+23:41)
kbrazil pts/0 kbrazil-mac.attlocal.net Fri Jul 17 01:52:05 2020 - crash (13:56)
kbrazil pts/1 192.168.71.1 Thu Jul 16 14:48:42 2020 - crash (1+00:59)
kbrazil pts/0 192.168.71.1 Thu Jul 16 14:10:31 2020 - Thu Jul 16 16:26:07 2020 (02:15)
kbrazil tty1 Thu Jul 16 14:09:55 2020 - crash (1+01:38)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Jul 16 08:35:02 2020 - Tue Jan 5 14:29:36 2021 (173+06:54)
kbrazil ttyS0 Wed Jul 8 13:44:04 2020 - crash (7+18:50)
kbrazil tty1 Wed Jul 8 13:12:29 2020 - crash (7+19:22)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Jul 8 11:27:06 2020 - Tue Jan 5 14:29:36 2021 (181+04:02)
kbrazil ttyS0 Fri Jun 26 11:53:28 2020 - crash (11+23:33)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Jun 26 11:52:15 2020 - Tue Jan 5 14:29:36 2021 (193+03:37)
kbrazil ttyS0 Tue Jun 23 15:23:50 2020 - Tue Jun 23 15:27:26 2020 (00:03)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jun 23 15:23:25 2020 - Tue Jun 23 15:27:28 2020 (00:04)
kbrazil pts/0 192.168.71.1 Fri Jun 19 10:47:07 2020 - crash (4+04:36)
kbrazil tty1 Fri Jun 19 10:46:46 2020 - crash (4+04:36)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Jun 19 10:29:25 2020 - Tue Jun 23 15:27:28 2020 (4+04:58)
kbrazil pts/0 192.168.71.1 Mon Jun 8 10:30:52 2020 - crash (10+23:58)
kbrazil tty1 Mon Jun 8 10:30:29 2020 - crash (10+23:58)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Jun 8 10:30:06 2020 - Tue Jun 23 15:27:28 2020 (15+04:57)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jun 2 12:05:38 2020 - Tue Jun 23 15:27:28 2020 (21+03:21)
kbrazil pts/0 192.168.71.1 Tue Jun 2 08:38:47 2020 - crash (03:26)
kbrazil tty1 Tue Jun 2 08:38:36 2020 - crash (03:27)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Jun 2 06:13:40 2020 - Tue Jun 23 15:27:28 2020 (21+09:13)
kbrazil pts/0 192.168.71.1 Sun May 24 16:10:42 2020 - Sun May 24 17:18:58 2020 (01:08)
kbrazil tty1 Sun May 24 15:34:27 2020 - crash (8+14:39)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Sun May 24 15:34:01 2020 - Tue Jun 23 15:27:28 2020 (29+23:53)
kbrazil pts/1 192.168.71.1 Fri May 22 13:39:48 2020 - crash (2+01:54)
kbrazil pts/0 192.168.71.1 Fri May 22 13:11:05 2020 - crash (2+02:22)
kbrazil tty1 Fri May 22 13:10:36 2020 - crash (2+02:23)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri May 22 12:49:57 2020 - Tue Jun 23 15:27:28 2020 (32+02:37)
kbrazil pts/0 192.168.71.1 Fri May 22 08:44:51 2020 - crash (04:05)
kbrazil tty1 Fri May 22 08:44:09 2020 - crash (04:05)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri May 22 08:43:50 2020 - Tue Jun 23 15:27:28 2020 (32+06:43)
kbrazil tty1 Thu May 14 16:39:13 2020 - crash (7+16:04)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu May 14 16:39:00 2020 - Tue Jun 23 15:27:28 2020 (39+22:48)
kbrazil pts/0 192.168.71.1 Wed May 13 10:23:33 2020 - crash (1+06:15)
kbrazil tty1 Wed May 13 10:22:38 2020 - crash (1+06:16)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed May 13 09:51:51 2020 - Tue Jun 23 15:27:28 2020 (41+05:35)
kbrazil pts/1 192.168.71.1 Wed Apr 15 13:00:16 2020 - crash (27+20:51)
kbrazil pts/0 192.168.71.1 Wed Apr 15 12:38:34 2020 - Wed Apr 15 13:01:29 2020 (00:22)
kbrazil tty1 Wed Apr 15 12:28:46 2020 - Wed Apr 15 20:44:22 2020 (08:15)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Apr 15 04:02:22 2020 - Tue Jun 23 15:27:28 2020 (69+11:25)
kbrazil ttyS0 Tue Apr 14 16:02:37 2020 - crash (11:59)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Apr 14 16:02:17 2020 - Tue Jun 23 15:27:28 2020 (69+23:25)
kbrazil ttyS0 Tue Apr 14 08:44:45 2020 - Tue Apr 14 10:00:46 2020 (01:16)
kbrazil ttyS0 Tue Apr 14 06:57:27 2020 - Tue Apr 14 08:44:39 2020 (01:47)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Apr 14 06:56:01 2020 - Tue Jun 23 15:27:28 2020 (70+08:31)
kbrazil tty1 Tue Apr 7 17:33:04 2020 - crash (6+13:22)
kbrazil tty1 Mon Apr 6 21:22:49 2020 - Mon Apr 6 22:42:06 2020 (01:19)
kbrazil tty1 Mon Apr 6 19:43:25 2020 - Mon Apr 6 19:45:24 2020 (00:01)
kbrazil ttyS0 Sat Apr 4 17:31:48 2020 - crash (9+13:24)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Sat Apr 4 17:17:00 2020 - Tue Jun 23 15:27:28 2020 (79+22:10)
kbrazil ttyS0 Sun Mar 29 12:42:56 2020 - crash (6+04:34)
kbrazil ttyS0 Tue Mar 24 11:21:56 2020 - Sun Mar 29 12:42:50 2020 (5+01:20)
kbrazil ttyS0 Tue Mar 24 11:18:00 2020 - Tue Mar 24 11:21:51 2020 (00:03)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Mar 24 10:57:02 2020 - Tue Jun 23 15:27:28 2020 (91+04:30)
kbrazil ttyS0 Tue Mar 17 06:56:55 2020 - crash (7+04:00)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Mar 17 05:12:10 2020 - Tue Jun 23 15:27:28 2020 (98+10:15)
kbrazil ttyS0 Thu Mar 12 10:12:42 2020 - crash (4+18:59)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Mar 12 09:22:03 2020 - Tue Jun 23 15:27:28 2020 (103+06:05)
kbrazil ttyS0 Wed Mar 11 13:29:24 2020 - crash (19:52)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Mar 11 12:19:59 2020 - Tue Jun 23 15:27:28 2020 (104+03:07)
kbrazil ttyS0 Tue Mar 10 17:53:11 2020 - crash (18:26)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Mar 10 17:52:57 2020 - Tue Jun 23 15:27:28 2020 (104+21:34)
kbrazil ttyS0 Tue Mar 10 13:09:01 2020 - crash (04:43)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Mar 10 13:08:45 2020 - Tue Jun 23 15:27:28 2020 (105+02:18)
kbrazil ttyS0 Sat Mar 7 18:13:19 2020 - crash (2+17:55)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Sat Mar 7 18:13:04 2020 - Tue Jun 23 15:27:28 2020 (107+20:14)
kbrazil ttyS0 Thu Mar 5 14:48:23 2020 - crash (2+03:24)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Mar 5 03:02:06 2020 - Tue Jun 23 15:27:28 2020 (110+11:25)
kbrazil ttyS0 Mon Mar 2 19:53:22 2020 - crash (2+07:08)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Mar 2 19:53:07 2020 - Tue Jun 23 15:27:28 2020 (112+18:34)
kbrazil pts/0 192.168.71.1 Sat Feb 29 18:43:55 2020 - crash (2+01:09)
kbrazil pts/1 192.168.71.1 Sat Feb 29 18:08:17 2020 - Sat Feb 29 18:28:47 2020 (00:20)
kbrazil pts/0 192.168.71.1 Sat Feb 29 15:16:16 2020 - Sat Feb 29 18:42:49 2020 (03:26)
kbrazil ttyS0 Sat Feb 29 12:14:10 2020 - crash (2+07:38)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Sat Feb 29 12:13:44 2020 - Tue Jun 23 15:27:28 2020 (115+02:13)
kbrazil ttyS0 Fri Feb 28 13:49:56 2020 - crash (22:23)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Feb 28 12:56:05 2020 - Tue Jun 23 15:27:28 2020 (116+01:31)
kbrazil ttyS0 Thu Feb 27 16:01:25 2020 - crash (20:54)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Feb 27 15:51:42 2020 - Tue Jun 23 15:27:28 2020 (116+22:35)
kbrazil ttyS0 Thu Feb 27 10:50:36 2020 - crash (05:01)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Feb 26 20:05:10 2020 - Tue Jun 23 15:27:28 2020 (117+18:22)
kbrazil ttyS0 Thu Feb 20 14:42:01 2020 - crash (6+05:23)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Feb 20 14:41:39 2020 - Tue Jun 23 15:27:28 2020 (123+23:45)
kbrazil ttyS0 Mon Feb 17 17:48:58 2020 - crash (2+20:52)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Feb 17 17:48:37 2020 - Tue Jun 23 15:27:28 2020 (126+20:38)
kbrazil ttyS0 Thu Feb 13 16:44:51 2020 - crash (4+01:03)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Thu Feb 13 16:44:31 2020 - Tue Jun 23 15:27:28 2020 (130+21:42)
kbrazil ttyS0 Wed Feb 5 14:23:46 2020 - crash (8+02:20)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Feb 5 11:43:15 2020 - Tue Jun 23 15:27:28 2020 (139+02:44)
kbrazil ttyS0 Tue Feb 4 14:28:14 2020 - crash (21:15)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Feb 4 01:28:02 2020 - Tue Jun 23 15:27:28 2020 (140+12:59)
kbrazil ttyS0 Mon Jan 13 17:28:13 2020 - crash (21+07:59)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Jan 13 16:16:04 2020 - Tue Jun 23 15:27:28 2020 (161+22:11)
kbrazil ttyS0 Mon Dec 16 11:15:00 2019 - crash (28+05:01)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Dec 16 11:14:30 2019 - Tue Jun 23 15:27:28 2020 (190+03:12)
kbrazil ttyS0 Wed Dec 4 21:41:25 2019 - crash (11+13:33)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Wed Dec 4 21:40:48 2019 - Tue Jun 23 15:27:28 2020 (201+16:46)
kbrazil pts/1 Sat Nov 16 14:40:36 2019 - Sat Nov 16 14:40:41 2019 (00:00)
kbrazil pts/1 Sat Nov 16 14:39:29 2019 - Sat Nov 16 14:39:42 2019 (00:00)
kbrazil pts/0 localhost Tue Nov 12 07:19:39 2019 - crash (22+14:21)
kbrazil ttyS0 Tue Nov 12 07:18:40 2019 - crash (22+14:22)
kbrazil pts/0 localhost Sun Nov 10 08:21:36 2019 - Mon Nov 11 15:22:36 2019 (1+07:01)
kbrazil ttyS0 Sat Nov 9 10:34:48 2019 - Tue Nov 12 07:16:59 2019 (2+20:42)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Sat Nov 9 10:34:26 2019 - Tue Jun 23 15:27:28 2020 (227+03:53)
kbrazil tty1 Fri Nov 8 07:49:24 2019 - crash (1+02:45)
kbrazil pts/0 192.168.71.1 Fri Nov 8 06:29:41 2019 - crash (1+04:04)
kbrazil ttyS0 Fri Nov 8 06:24:27 2019 - crash (1+04:09)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Nov 8 06:14:17 2019 - Tue Jun 23 15:27:28 2020 (228+08:13)
kbrazil tty1 Sun Nov 3 12:20:05 2019 - crash (4+17:54)
kbrazil ttyS0 Sun Nov 3 11:04:48 2019 - Sun Nov 3 11:05:50 2019 (00:01)
kbrazil pts/0 192.168.71.1 Sat Nov 2 19:26:52 2019 - crash (5+11:47)
kbrazil ttyS0 Fri Nov 1 15:14:12 2019 - Sun Nov 3 11:03:55 2019 (1+20:49)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Nov 1 15:13:19 2019 - Tue Jun 23 15:27:28 2020 (235+00:14)
kbrazil ttyS0 Fri Nov 1 11:16:36 2019 - Fri Nov 1 11:36:43 2019 (00:20)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Nov 1 06:00:15 2019 - Fri Nov 1 11:36:44 2019 (05:36)
kbrazil ttyS0 Tue Oct 29 18:17:00 2019 - crash (2+11:43)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Tue Oct 29 18:16:45 2019 - Fri Nov 1 11:36:44 2019 (2+17:19)
kbrazil pts/0 192.168.71.1 Sat Oct 26 09:53:36 2019 - Sat Oct 26 15:13:20 2019 (05:19)
kbrazil ttyS0 Fri Oct 25 18:22:10 2019 - crash (3+23:54)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Oct 25 18:21:45 2019 - Fri Nov 1 11:36:44 2019 (6+17:14)
kbrazil ttyS0 Fri Oct 25 17:14:54 2019 - Fri Oct 25 18:21:32 2019 (01:06)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Oct 25 17:13:49 2019 - Fri Nov 1 11:36:44 2019 (6+18:22)
kbrazil ttyS0 Fri Oct 25 15:43:55 2019 - Fri Oct 25 17:13:43 2019 (01:29)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Fri Oct 25 13:29:01 2019 - Fri Oct 25 17:13:45 2019 (03:44)
kbrazil ttyS0 Mon Oct 21 13:19:30 2019 - Wed Oct 23 19:22:56 2019 (2+06:03)
reboot system boot 3.10.0-1062.1.2.el7.x86_64 Mon Oct 21 13:17:47 2019 - Wed Oct 23 19:22:58 2019 (2+06:05)
kbrazil ttyS0 Wed Oct 16 03:23:21 2019 - crash (5+09:54)
kbrazil ttyS0 Tue Oct 15 16:49:02 2019 - Wed Oct 16 03:23:15 2019 (10:34)
kbrazil ttyS0 Tue Oct 15 10:39:44 2019 - Tue Oct 15 16:48:54 2019 (06:09)
reboot system boot 3.10.0-957.27.2.el7.x86_64 Tue Oct 15 10:39:10 2019 - Wed Oct 23 19:22:58 2019 (8+08:43)
kbrazil ttyS0 Thu Aug 15 16:05:30 2019 - Thu Aug 15 16:05:50 2019 (00:00)
reboot system boot 3.10.0-957.27.2.el7.x86_64 Thu Aug 15 16:05:10 2019 - Thu Aug 15 16:05:52 2019 (00:00)
reboot system boot 3.10.0-957.27.2.el7.x86_64 Thu Aug 15 16:00:45 2019 - Thu Aug 15 16:05:52 2019 (00:05)
kbrazil ttyS0 Thu Aug 15 14:25:00 2019 - crash (01:35)
reboot system boot 3.10.0-957.27.2.el7.x86_64 Thu Aug 15 14:24:43 2019 - Thu Aug 15 16:05:52 2019 (01:41)
kbrazil ttyS0 Thu Aug 15 11:58:46 2019 - crash (02:25)
reboot system boot 3.10.0-957.el7.x86_64 Thu Aug 15 11:58:06 2019 - Thu Aug 15 16:05:52 2019 (04:07)
kbrazil ttyS0 Thu Aug 15 11:57:28 2019 - Thu Aug 15 11:57:40 2019 (00:00)
reboot system boot 3.10.0-957.el7.x86_64 Thu Aug 15 11:57:07 2019 - Thu Aug 15 16:05:52 2019 (04:08)
kbrazil pts/0 192.168.71.1 Thu Aug 15 10:58:29 2019 - Thu Aug 15 11:56:42 2019 (00:58)
root tty1 Thu Aug 15 10:57:26 2019 - Thu Aug 15 11:56:42 2019 (00:59)
reboot system boot 3.10.0-957.el7.x86_64 Thu Aug 15 10:57:06 2019 - Thu Aug 15 11:56:44 2019 (00:59)
wtmp begins Thu Aug 15 10:57:06 2019

View File

@ -40,6 +40,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/last-F.out'), 'r', encoding='utf-8') as f:
self.ubuntu_20_4_last_F = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last-crash.out'), 'r', encoding='utf-8') as f:
self.centos_7_7_last_crash = f.read()
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last-wF.out'), 'r', encoding='utf-8') as f:
self.centos_7_7_last_wF = f.read()
# output
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_last_json = json.loads(f.read())
@ -71,6 +77,12 @@ class MyTests(unittest.TestCase):
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-20.04/last-F.json'), 'r', encoding='utf-8') as f:
self.ubuntu_20_4_last_F_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last-crash.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_last_crash_json = json.loads(f.read())
with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/last-wF.json'), 'r', encoding='utf-8') as f:
self.centos_7_7_last_wF_json = json.loads(f.read())
def test_last_nodata(self):
"""
Test plain 'last' with no data
@ -137,6 +149,17 @@ class MyTests(unittest.TestCase):
"""
self.assertEqual(jc.parsers.last.parse(self.freebsd12_last, quiet=True), self.freebsd12_last_json)
def test_last_crash_centos_7_7(self):
"""
Test plain 'last' on Centos 7.7 with crash entries
"""
self.assertEqual(jc.parsers.last.parse(self.centos_7_7_last_crash, quiet=True), self.centos_7_7_last_crash_json)
def test_last_wF_centos_7_7(self):
"""
Test 'last -wF' on Centos 7.7
"""
self.assertEqual(jc.parsers.last.parse(self.centos_7_7_last_wF, quiet=True), self.centos_7_7_last_wF_json)
if __name__ == '__main__':
unittest.main()