ucspilogd.html (3475B)
1 <html> 2 <head> 3 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 <meta http-equiv="Content-Language" content="en" /> 6 <title>s6: the ucspilogd program</title> 7 <meta name="Description" content="s6: the ucspilogd program" /> 8 <meta name="Keywords" content="s6 command ucspilogd log logging UCSPI" /> 9 <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> --> 10 </head> 11 <body> 12 13 <p> 14 <a href="../">s6</a><br /> 15 <a href="//skarnet.org/software/">Software</a><br /> 16 <a href="//skarnet.org/">skarnet.org</a> 17 </p> 18 19 <h1> The <tt>ucspilogd</tt> program </h1> 20 21 <p> 22 <tt>ucspilogd</tt> acts as a filter, converting syslog facility 23 numbers and alert levels into names. 24 </p> 25 26 <h2> Interface </h2> 27 28 <pre> 29 ucspilogd [ -d <em>undef</em> ] [ <em>var</em> ... ] 30 </pre> 31 32 <ul> 33 <li> ucspilogd reads a stream of syslog-like messages on stdin. 34 Those messages can be newline-terminated or null-terminated. </li> 35 <li> For every line it reads: if it has been given <em>var</em> 36 arguments, it writes the value of every <em>var</em> environment 37 variable, followed by a colon and a space. </li> 38 <li> If the line begins with a syslog facility number and/or 39 alert level in the syslog format, it converts them into a 40 human-readable name in the syslogd fashion. </li> 41 <li> It then writes the processed line to stdout. </li> 42 </ul> 43 44 <h2> Options </h2> 45 46 <ul> 47 <li> <tt>-d <em>undef</em></tt> : when a variable 48 <em>var</em> given on the command line is actually undefined at 49 ucspilogd execution time, print <em>undef</em> in place of what 50 would be the variable's value on every line. Default is the 51 string <tt><undefined></tt>. </li> 52 </ul> 53 54 55 <h2> Common use </h2> 56 57 <p> 58 You can emulate the whole <em>syslogd</em> behaviour by combining the following 59 components: 60 </p> 61 62 <ul> 63 <li> A Unix stream super-server such as 64 <a href="s6-ipcserver.html">s6-ipcserver</a> 65 listening to the Unix domain socket <tt>/dev/log</tt>, to connect to 66 the kernel log-reading interface. </li> 67 <li> <tt>ucspilogd</tt> running under that super-server, to read the 68 logs and perform adequate transformations. </li> 69 <li> A logger such as 70 <a href="s6-log.html">s6-log</a> 71 to store the logs into the filesystem. </li> 72 <li> A supervision mechanism such as s6, 73 to ensure ease of use and reliability of the whole chain. </li> 74 </ul> 75 76 <p> 77 The resulting suite of programs is still smaller, and way more reliable, 78 than a standard <em>syslogd</em>. 79 </p> 80 81 <p> 82 In the <tt>examples/syslogd-linux</tt> subdirectory of the s6 package, you will 83 find a suitable ucspilogd <a href="servicedir.html">service directory</a>. 84 The run scripts are written in the 85 <a href="//skarnet.org/software/execline/">execline</a> 86 language. 87 </p> 88 89 <h2> Using <tt>ucspilogd</tt> as a <em>klogd</em> replacement </h2> 90 91 <p> 92 Certain Unix kernels offer a nice interface to the kernel logs. 93 For instance, the Linux kernel provides the <tt>/proc/kmsg</tt> fake 94 file, that can be opened and read like a normal file, excepts that 95 it gives the kernel logs when they are available and blocks otherwise. 96 You can use <tt>ucspilogd</tt> to process data from those interfaces. 97 </p> 98 99 <p> 100 The <tt>examples/klogd-linux</tt> subdirectory of the s6 package 101 is a <a href="servicedir.html">service directory</a> providing such a <em>klogd</em> service 102 for Linux, using the <tt>/proc/kmsg</tt> interface. 103 </p> 104 105 </body> 106 </html>