blob: 7d87b5e43c8c0d762fe3fadfa0728fb8d3cc6f1c (
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
65
66
67
68
69
70
71
72
73
|
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<title>s6-linux-utils: the s6-logwatch program</title>
<meta name="Description" content="s6-linux-utils: the s6-logwatch program" />
<meta name="Keywords" content="s6-linux-utils linux utilities log s6-log logwatch" />
<!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
</head>
<body>
<p>
<a href="index.html">s6-linux-utils</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>
<h1> The <tt>s6-logwatch</tt> program </h1>
<p>
<tt>s6-logwatch</tt> watches the <tt>current</tt> file of a logdir, printing it
in real time.
</p>
<h2> Interface </h2>
<pre>
s6-logwatch [ -m <em>buflen</em> ] <em>logdir</em>
</pre>
<ul>
<li> s6-logwatch prints <em>logdir</em><tt>/current</tt> and watches
the file. </li>
<li> <em>logdir</em> must be managed by a
<a href="//skarnet.org/software/s6/s6-log.html">s6-log</a> instance. </li>
<li> When new logs are appended to the <tt>current</tt> file, s6-logwatch prints
them in real-time to stdout. </li>
<li> When a rotation happens, s6-logwatch notices, and keeps watching the
new <tt>current</tt> file. </li>
<li> s6-logwatch runs forever until killed. </li>
</ul>
<h2> Options </h2>
<ul>
<li> <tt>-m</tt> <em>buflen</em> : accumulate at most <em>buflen</em>
bytes into the stdout buffer before flushing it. By default, <em>buflen</em> is
4000. </li>
</ul>
<h2> Bugs </h2>
<ul>
<li> s6-logwatch is not entirely reliable because there is an unavoidable
race condition when a rotation occurs; it's a hack for humans to keep reading
logs across rotations, not a tool to be used in safe programming. When the
race condition is triggered, s6-logwatch will be unable to understand what
state <em>logdir</em> is in and will exit 101 with an error message. </li>
<li> Specific support in the logger program would be needed to avoid this
race condition; it would significantly bloat the logger program, so it has
not been deemed useful. </li>
</ul>
<h2> Notes </h2>
<ul>
<li> s6-logwatch is Linux-specific because it uses the
<a href="http://inotify.aiken.cz/">inotify</a> interface. </li>
</ul>
</body>
</html>
|