about summary refs log tree commit diff
path: root/mlog.1
blob: edbd3a92c7189ba0eb61e0d2fa1b2928ed9e003b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
.Dd January 12, 2024
.Dt MLOG 1
.Os
.Sh NAME
.Nm mlog
.Nd merge log files by timestamp
.Sh SYNOPSIS
.Nm
.Op Fl f
.Op Fl s
.Op Fl u
.Op Ar files\ ...
.Sh DESCRIPTION
.Nm
reads lines from multiple log files and prints them in chronological order.
The files need to start with comparable timestamps.
.Nm
prints the oldest line first, thus preserving relative order.
.Pp
.Nm
behaves like a combination of
.Ql sort -m
and
.Ql tail -f .
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl f
Follow the output files, output appended lines as file grows.
When the file is truncated or recreated, start from beginning.
With two
.Fl f
flags, seek to the end of files on start and only print fresh lines.
.It Fl s
Strip a prefix generated by
.Xr socklog 8
from each line, which have a format like
.Ql Ar facility Ns \&. Ns Ar priority Ns \&: Ar timestamp .
.It Fl u
Only print unique lines.
If other files contain the same line at the current position, skip them.
.El
.Sh EXIT STATUS
.Ex -std
.Sh INTERNALS
On Linux,
.Xr inotify 7
is used to detect file changes.
.Sh SEE ALSO
.Xr tail 1 ,
.Xr sort 1 ,
.Xr svlogd 8
.Sh AUTHORS
.An Leah Neukirchen Aq Mt leah@vuxu.org
.Sh LICENSE
.Nm
is in the public domain.
.Pp
To the extent possible under law,
the creator of this work
has waived all copyright and related or
neighboring rights to this work.
.Pp
.Lk http://creativecommons.org/publicdomain/zero/1.0/