<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Makura no Soshi &#187; Syslog</title>
	<atom:link href="http://mschuette.name/wp/category/admin/syslog/feed/" rel="self" type="application/rss+xml" />
	<link>http://mschuette.name/wp</link>
	<description>枕草子</description>
	<lastBuildDate>Tue, 22 May 2012 08:32:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Dying &#8216;try&#8217; processes</title>
		<link>http://mschuette.name/wp/2011/11/dying-try-processes/</link>
		<comments>http://mschuette.name/wp/2011/11/dying-try-processes/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 06:51:17 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[amd64]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=736</guid>
		<description><![CDATA[Note: This syslog entry is puzzling if the system has no program named try, but no cause for concern: 2011-11-19T01:31:21 frodo kernel: pid 47812 (try), uid 0: exited on signal 10 (core dumped) Source of the program is Perl&#8217;s Configure script, which compiles its C library test cases into programs named try. And apparently amd64 [...]]]></description>
			<content:encoded><![CDATA[<p>Note: This syslog entry is puzzling if the system has no program named <code>try</code>, but no cause for concern:</p>
<blockquote><p><code>2011-11-19T01:31:21 frodo kernel: pid 47812 (try), uid 0: exited on signal 10 (core dumped)</code></p></blockquote>
<p>Source of the program is Perl&#8217;s Configure script, which compiles its C library test cases into programs named <code>try</code>. And apparently amd64 systems need to use the function <code>va_copy()</code> because the test case without this function leads to a segfault.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2011/11/dying-try-processes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple log event histograms</title>
		<link>http://mschuette.name/wp/2010/03/simple-log-event-histograms/</link>
		<comments>http://mschuette.name/wp/2010/03/simple-log-event-histograms/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 08:47:46 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[histogram]]></category>
		<category><![CDATA[logging]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=517</guid>
		<description><![CDATA[Just to preserve it, here&#8217;s a useful shell command line to print a histogram of frequent log events: grep -h 'expr' files &#124; cut -d ' ' -f 1,2 &#124; uniq -c &#124; awk '{step=5; bar = ""; for(i = $1; i&#62;=1; i = i-step) bar = bar "#"; printf $2, $3, bar; }' Depending [...]]]></description>
			<content:encoded><![CDATA[<p>Just to preserve it, here&#8217;s a useful shell command line to print a histogram of frequent log events:<br />
<code>grep -h '<em>expr</em>' <em>files</em> | cut -d ' ' -f 1,2 | uniq -c | awk '{step=5; bar = ""; for(i = $1; i&gt;=1; i = i-step) bar = bar "#"; printf $2, $3, bar; }'</code></p>
<p>Depending on the number of events the <code>step</code> has to be adjusted. The arguments to cut determine the used time intervals; the above aussumes a traditional BSD Syslog timestamp and will yield daily counts. For hourly counts one can use <code>cut -d : -f 1</code> (then the print command has to be changed as well to <code>printf $2, $3, $4, bar;</code>) &#8212; for Syslog-Protocol timestamps one can use <code>cut -d T -f 1</code> or <code>cut -d : -f 1</code>. Note that only intervals with matches are shown, there is no easy way to add empty lines.</p>
<p>Example:</p>
<pre>[mschuett@mail] /var/log&gt; fgrep -h 'idle for too long, closing connection' cyruslog | cut -d T -f 1 | uniq -c | awk '{step=10; bar = ""; for(i = $1; i&gt;=1; i = i-step) bar = bar "#"; print $2, bar; }'
2010-03-01 ########################
2010-03-02 ################################
2010-03-03 #####################
2010-03-04 ##############################
2010-03-05 #################################
2010-03-06 ######################
2010-03-07 ###########################
2010-03-08 #####################
2010-03-09 ###################
2010-03-10 #####################
2010-03-11 ##################</pre>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/03/simple-log-event-histograms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP syslog patch</title>
		<link>http://mschuette.name/wp/2010/03/php-syslog-patch/</link>
		<comments>http://mschuette.name/wp/2010/03/php-syslog-patch/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 13:04:30 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[suphp]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=502</guid>
		<description><![CDATA[Given a multiuser webserver with PHP and error logging to syslog. Problem: how do you correlate error messages with users? This patch lets PHP call openlog() with a configurable program name. My first approach was to filter by file and path names, but not every message includes a filename, so I was left with some [...]]]></description>
			<content:encoded><![CDATA[<p>Given a multiuser webserver with PHP and error logging to syslog. Problem: how do you correlate error messages with users? This patch lets PHP call <code>openlog()</code> with a configurable program name.</p>
<p>My first approach was to filter by file and path names, but not every message includes a filename, so I was left with some lines like these:</p>
<blockquote><p><code>2010-03-15T00:00:15.00+01:00 server php-cgi: Undeclared entity warning at line 54, column 8</code></p></blockquote>
<p>To overcome the problem I introduce two new php.ini variables: <code>syslog.program</code>, to give the program name, and the boolean <code>syslog.pid</code>, to enable logging the PID. Default values are <code>""</code> and <code>Off</code>, resulting in the previous behaviour (using the executable name as program name without PID). I use <a href="http://www.suphp.org/">suphp</a>, so every user has an own php.ini with <code>syslog.program</code> set to &#8220;php/username&#8221;, thus writing log lines like:</p>
<blockquote><p><code>2010-03-19T09:00:14.00+01:00 server php/mschuett[87777]: Undeclared entity warning at line 54, column 8</code></p></blockquote>
<p>With mod_php the variables can also be set per directory with <code>php_admin_value</code>. Changing them with <code>ini_set()</code> is not supported (not necessary because a new call to <code>openlog()</code> has the same effect). For enhanced security one could/should also use the php.ini setting <code>disable_functions=openlog</code> to prevent users from overriding these settings.</p>
<p>Because the source file is also affected by the <a href="http://www.hardened-php.net/suhosin/">Suhosin</a> patch, I prepared two diffs:</p>
<ul>
<li>PHP 5.2.12:<a href="/files/patch-php5.2.12.ext_standard_syslog.diff">patch-php5.2.12.ext_standard_syslog.diff</a></li>
<li>PHP  5.2.12 with Suhosin: <a href="/files/patch-php5.2.12.suhosin.ext_standard_syslog.diff">patch-php5.2.12.suhosin.ext_standard_syslog.diff</a></li>
</ul>
<p>[<strong>Update:</strong> the patches still work for PHP 5.3.6]<br />
[<strong>Update2:</strong> finally got around to write a <a href="http://bugs.php.net/bug.php?id=54144">Feature Request #54144</a>] </p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/03/php-syslog-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solaris syslog and message IDs</title>
		<link>http://mschuette.name/wp/2010/03/solaris-syslog-and-message-ids/</link>
		<comments>http://mschuette.name/wp/2010/03/solaris-syslog-and-message-ids/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 16:12:05 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[opensolaris]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">https://mschuette.name/wp/?p=494</guid>
		<description><![CDATA[I finally checked how the Solaris kernel assigns message IDs to its log messages. These messages have an interesting format like: Sep 29 21:41:18 cathy ufs: [ID 845546 kern.notice] alloc /: file system full I found the thought fascinating to have a system- (or at least kernel-) wide list of all possible log events; but [...]]]></description>
			<content:encoded><![CDATA[<p>I finally checked how the Solaris kernel assigns message IDs to its log messages.</p>
<p>These messages have an interesting format like:<br />
<code> Sep 29 21:41:18 cathy ufs: [ID 845546 kern.notice] alloc /: file system full</code></p>
<p>I found the thought fascinating to have a system- (or at least kernel-) wide list of all possible log events; but it does not work like that. Actually the message ID is a hash value over the format string of the message (in the example the string is: <code>"alloc: %s: file system full"</code>); for a description see <a href="http://docs.sun.com/app/docs/doc/819-2240/msgid-1m">msgid(1M)</a> and the calculation <a href="http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/strlog.h#103"><code>STRLOG_MAKE_MSGID()</code></a>. In practice these hashes are probably unique (even more so in combination with the severity <code>notice </code>and the subsystem <code>ufs</code>), but I would expect to find <span style="text-decoration: line-through;">collisions</span> duplicate IDs for very simple or generic format strings (like <code>printf("%s", some_string)</code> or <code>printf("%s: %d", some_key, some_value)</code>).</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2010/03/solaris-syslog-and-message-ids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CLT09</title>
		<link>http://mschuette.name/wp/2009/03/clt09/</link>
		<comments>http://mschuette.name/wp/2009/03/clt09/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 11:53:58 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[clt09]]></category>

		<guid isPermaLink="false">http://mschuette.name/wp/?p=251</guid>
		<description><![CDATA[Und nun der obligatorische Eintrag live vom BSD-Stand auf den Chemnitzer Linux-Tagen. Mein eigener Vortrag zu den Syslog-RFCs lief gut. Grunix hat auch schon erste Bilder.]]></description>
			<content:encoded><![CDATA[<p>Und nun der obligatorische Eintrag live vom BSD-Stand auf den <a href="http://chemnitzer.linux-tage.de/2009/info/">Chemnitzer Linux-Tagen</a>.<br />
Mein eigener <a href="http://fara.cs.uni-potsdam.de/~mschuett/uplug/SyslogRFC_CLT_090314.pdf">Vortrag zu den Syslog-RFCs</a> lief gut. <a href="http://grunix.de/archives/2009-03-14/530/CLT2009-Erste-Bilder-Chemnitzer-LinuxTage-2009/">Grunix</a> hat auch schon erste Bilder.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2009/03/clt09/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally, the Syslog RFCs</title>
		<link>http://mschuette.name/wp/2009/03/finally-the-syslog-rfcs/</link>
		<comments>http://mschuette.name/wp/2009/03/finally-the-syslog-rfcs/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 19:46:41 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[GSoC08]]></category>
		<category><![CDATA[Syslog]]></category>

		<guid isPermaLink="false">http://mschuette.name/wp/?p=246</guid>
		<description><![CDATA[Today the RFCs for the new Syslog procol and transport were published: RFC 5424 on The Syslog Protocol RFC 5425 on Transport Layer Security (TLS) Transport Mapping for Syslog RFC 5426 on Transmission of Syslog Messages over UDP]]></description>
			<content:encoded><![CDATA[<p>Today the RFCs for the new Syslog procol and transport were published:</p>
<ul>
<li><a href="http://www.rfc-editor.org/rfc/rfc5424.txt">RFC 5424 on The Syslog Protocol</a></li>
<li><a href="http://www.rfc-editor.org/rfc/rfc5425.txt">RFC 5425 on Transport Layer Security (TLS) Transport Mapping for Syslog</a></li>
<li><a href="http://www.rfc-editor.org/rfc/rfc5426.txt">RFC 5426 on Transmission of Syslog Messages over UDP </a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2009/03/finally-the-syslog-rfcs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Syslog line length statistic</title>
		<link>http://mschuette.name/wp/2008/08/syslog-line-length-statistic/</link>
		<comments>http://mschuette.name/wp/2008/08/syslog-line-length-statistic/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 15:55:30 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Admin]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[line lengths]]></category>
		<category><![CDATA[statistic]]></category>

		<guid isPermaLink="false">http://mschuette.name/wp/?p=101</guid>
		<description><![CDATA[Time for some useless statistics&#8230; Because I had to set some initial buffer sizes in syslogd I took a closer look at my log files. I used all logs from last month and counted the line lengths for every message to get an impression of real-life requirements on message/line lenghts. Complete plot: occurance count by [...]]]></description>
			<content:encoded><![CDATA[<p>Time for some useless statistics&#8230; Because I had to set some initial buffer sizes in syslogd I took a closer look at my log files. I used all logs from last month and counted the line lengths for every message to get an impression of real-life requirements on message/line lenghts.</p>
<div class="wp-caption aligncenter" style="width: 650px"><img title="Complete plot: occurance count by line length" src="/wp/wp-upload/logline-length-big.png" alt="Complete plot of line lengths" width="640" height="480" /><p class="wp-caption-text">Complete plot: occurance count by line length</p></div>
<div class="wp-caption aligncenter" style="width: 650px"><img title="Detail: occurance count for line lengths ≤ 250" src="/wp/wp-upload/logline-length-detail.png" alt="Detail (len250) from plot" width="640" height="480" /><p class="wp-caption-text">Detail: occurance count for line lengths ≤ 250</p></div>
<p>As every real data set the selection is somewhat skewed. It includes Apache httpd access logs but no httpd error logs. The Windows logs are collected from NTSyslog but are non-representative because they include many WPKG debug messages. I also use ISO instead of BSD timestamps, so every line is 14 chars longer than with traditional syslogd; the timestamp, the hostname and a programname/tag use around 50 chars which is the minimum lenght here. The most notable artifact are the many long (&gt;800 chars) messages. &#8212; These are syslog-ng log statistics from the logserver itself (used for monitoring).</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2008/08/syslog-line-length-statistic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reliable TCP reconnect made easy</title>
		<link>http://mschuette.name/wp/2008/05/reliable-tcp-reconnect-made-easy/</link>
		<comments>http://mschuette.name/wp/2008/05/reliable-tcp-reconnect-made-easy/#comments</comments>
		<pubDate>Wed, 28 May 2008 22:53:52 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[GSoC08]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[relp]]></category>
		<category><![CDATA[socket]]></category>
		<category><![CDATA[tcp]]></category>

		<guid isPermaLink="false">http://mschuette.name/wp/?p=71</guid>
		<description><![CDATA[When I came to work on Syslog one of the most disturbing texts I came across was Rainer&#8217;s observation &#8220;On the (un)reliability of plain tcp syslog&#8230;&#8220;. The problem is that a sendmsg() system call is nearly always successful &#8212; it only indicates local errors (like a full send queue), but no network errors. So even [...]]]></description>
			<content:encoded><![CDATA[<p>When I came to work on Syslog one of the most disturbing texts I came across was Rainer&#8217;s observation &#8220;<a href="http://blog.gerhards.net/2008/04/on-unreliability-of-plain-tcp-syslog.html">On the (un)reliability of plain tcp syslog&#8230;</a>&#8220;. The problem is that a <code>sendmsg()</code> system call is nearly always successful &#8212; it only indicates local errors (like a full send queue), but no network errors. So even after the other side initiated a connection shutdown one can happily write into the local buffer and only get an error on the second write.</p>
<p>Most applications and protocols use a request-response or a session model and do not have problems with this, because they simply reset their status on connection loss and start again. Syslog is different because it does not use a backchannel (for acks or other server responses) and completely relies on the one-direction channel for server and client to synchronize their states over long periods of time <em>and</em> across connection losses. After reading Rainer&#8217;s text it took me some time to believe the problem described, and even then I saw the words and accepted the reasoning, but it still felt wrong to believe in them.</p>
<p>This week I began my own Syslog programming with a small client/server program to test different IPC protocols; and the plain TCP variant nicely confirmed the observation above. Only after trying SCTP which did not have that problem, I realized that we asked the wrong question. (I did not dig into it but I guess the socket is marked broken really fast on connection shutdown, so the first write to it returns an error  immediately). &#8212; <code>sendmsg()</code> is not our only interface to the TCP-layer and if <code>sendmsg()</code> does not tell us whether a connection is still established then we just have to use another interface.</p>
<p>My first experiment lead to a bad solution: I found that Linux and FreeBSD have a <code>struct tcp_info</code> with TCP state information that can be accessed with <code>getsockopt()</code>. This allows us to always check if the connection is still established:</p>
<blockquote>
<pre>getsockopt(sock, IPPROTO_TCP, TCP_INFO, &amp;tinfo, &amp;tinfo_size)
if (tinfo.tcpi_state != TCPS_ESTABLISHED) {
  if (sock) { close(sock); }
  /* reconnect */
}
/* send() */
</pre>
</blockquote>
<p>After that I finally found the good and really simple solution: Just use <code>recv()</code> to check on the connection status. On connection shutdown <code>recv()</code> immediately indicates that the socket is unavailable and the application can react upon it by reconnecting:</p>
<blockquote>
<pre>rc = recv(sock, msgbuf, BUFSIZE, MSG_DONTWAIT | MSG_PEEK);
if (!rc) {
    if (errno == EAGAIN) {
        /* server closed connection */
        connected = 0;
    } else {
        perror("Error in recv()");
    }
}
if (!connected) {
    /* (re)connect */
    connected = 1;
}
/* send() */
</pre>
</blockquote>
<p><a href="https://barney.cs.uni-potsdam.de/trac/syslogd/browser/trunk/testing/tcp">Source code is online in my Trac</a>. Note that the <code>tcp_info</code> version only works on FreeBSD; on Linux I did not find the necessary header files yet and NetBSD does not support <code>tcp_info</code> (bad solution anyway).</p>
<p><strong>Update</strong>: Just a note on the intention and the kind of problem that is solved here. TCP has no atomic and synchronous send. Period and no need to argue.</p>
<p>With &#8220;real&#8221; network problems TCP does not show errors immediately because it was practically designed not to. (I have already worked on failur tolerance in a cluster computing environment and there are similar problems.)</p>
<p>The main problem I want to improve on is the simple LAN without connection or even packet loss. Where it is really unnecessary (and annoying) for a TCP-based syslog to derministically loose messages on a server reload, just because the client does not react upon a nice and clean connection shutdown.</p>
<p><strong>Later Update (22.6.):</strong> One obvious problem is the additional system call per socket operation. So I am quite happy I do not have to use this in the BSD <a href="http://netbsd-soc.sourceforge.net/projects/syslogd/">syslogd implementation</a>. I found it much easier to register a BSD <a href="http://www.freebsd.org/cgi/man.cgi?query=kqueue&amp;manpath=NetBSD+4.0"><em>kernel event</em></a> on the socket. That way the kernel immediately notifies the application when there is either data to read from the socket or when it is closed.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2008/05/reliable-tcp-reconnect-made-easy/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Use syslog-sign with changing structured data elements</title>
		<link>http://mschuette.name/wp/2008/05/use-syslog-sign-with-changing-structured-data-elements/</link>
		<comments>http://mschuette.name/wp/2008/05/use-syslog-sign-with-changing-structured-data-elements/#comments</comments>
		<pubDate>Fri, 09 May 2008 00:50:19 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[Syslog]]></category>
		<category><![CDATA[syslog-protocol]]></category>
		<category><![CDATA[syslog-sign]]></category>
		<category><![CDATA[transport]]></category>

		<guid isPermaLink="false">http://mschuette.name/wp/?p=68</guid>
		<description><![CDATA[The structured data (SD) in syslog-protocol offers some interesting possibilities when it comes to modifying a message in transit. What would be necessary to enable rewriting in transit while still be able to authenticate by syslog-sign? One example where one might rewrite syslog messages is to preserve multiple sending and receiving timestamps. This is useful [...]]]></description>
			<content:encoded><![CDATA[<p>The structured data (SD) in syslog-protocol offers some interesting possibilities when it comes to modifying a message in transit. What would be necessary to enable rewriting in transit while still be able to authenticate by syslog-sign?</p>
<p>One example where one might rewrite syslog messages is to preserve multiple sending and receiving timestamps. This is useful because a wrong system clock makes the sending timestamp mostly worthless, so you want the logserver to write its own time into the mesage. But if there is a network outage and the client buffers its messages for some time, then sending and receiving timestamps are also different but in this case the sending timestamp is the accurate one. &#8212; Thus simply replacing the messages&#8217; timestamp is no general solution, but having multiple timestamps is.</p>
<p>With SD every syslogd could just write its local time into every message, not unlike a Received: line in e-mails (in theory it could do so with BSD Syslog as well, but the important difference is that a new SD element will not mess up later parsing and analysis).</p>
<p>Consider these examples:</p>
<blockquote><p><code>&lt;34&gt;1 2003-10-11T22:14:15.003Z mymachine.example.com logger - - [transport relay1="relay.example.com" timestamp1="2003-10-11T24:14:16.000-02:00" relay2="logserver.example.com" timestamp2="2003-10-11T18:14:16.702+04:00"] Hello World</code></p>
<p><code>&lt;34&gt;1 2003-10-11T22:14:15.009Z mymachine.example.com logger - - [transport relay1="relay.example.com" timestamp1="2003-10-11T24:14:15.840-02:00" relay2="logserver.example.com" timestamp2="2003-10-11T18:54:16.702+04:00"] Hello World</code></p></blockquote>
<p>The first message shows a clean transport; but the second message indicates a network problem between the relays because <code>logserver.example.com</code> received it 40 minutes after <code>relay.example.com</code>, so it might have been buffered for that time.</p>
<p>But now enter syslog-sign: Once you sign your messages on one device you most not alter them on their way to their destination as every changes invalidates the signature!</p>
<p>But what if we really really want to add routing information? Would it be feasible to define a structured data element that might be inserted at will and had to be removed before checking signatures?</p>
<p>I think the following specification would suffice for this:</p>
<ul>
<li>Define some SD element with SD-ID &#8220;transport&#8221; to be used to track transport of syslog messages across different relays.</li>
<li>Every device might insert a transport SD element into the SD field. If other SD elements are present then their order must not be changed; otherwise the new SD element replaces the dash (<code>-</code>).</li>
<li>All parameters get natural numbers as suffixes. Every device that writes transport information has to check whether a transport SD element is already present. It has to use the parameters with the lowest unused number as suffixes.</li>
<li>Before signing or signature checking the transport SD element is removed from the message. If it is the only SD element, then it is replaced by a dash (<code>-</code>) to keep the message well-formed.</li>
</ul>
<p>Using the example above, we start with this message which might be signed at the originating device:</p>
<blockquote><p><code>&lt;34&gt;1 2003-10-11T22:14:15.003Z mymachine.example.com logger - - - Hello World</code></p></blockquote>
<p>This gets submittet to <code>relay.example.com</code> which inserts the transport SD element:</p>
<blockquote><p><code>&lt;34&gt;1 2003-10-11T22:14:15.003Z mymachine.example.com logger - - [transport relay1="relay.example.com" timestamp1="2003-10-11T24:14:16.000-02:00"] Hello World</code></p></blockquote>
<p>and later <code>logserver.example.com</code> which adds additional parameters to the transport SD element, yielding the message as above:</p>
<blockquote><p><code>&lt;34&gt;1 2003-10-11T22:14:15.003Z mymachine.example.com logger - - [transport relay1="relay.example.com" timestamp1="2003-10-11T24:14:16.000-02:00" relay2="logserver.example.com" timestamp2="2003-10-11T18:14:16.702+04:00"] Hello World</code></p></blockquote>
<p>Now say <code>logserver.example.com</code> checks the messages&#8217; signature with syslog-sign. Then it would remove the transport SD element before doing so, thus calculating the hash over</p>
<blockquote><p><code>&lt;34&gt;1 2003-10-11T22:14:15.003Z mymachine.example.com logger - - - Hello World</code></p></blockquote>
<p>which would be valid and match the signature as it is the same message as was sent from <code>mymachine.example.com</code> in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2008/05/use-syslog-sign-with-changing-structured-data-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Summer of Code</title>
		<link>http://mschuette.name/wp/2008/04/google-summer-of-code/</link>
		<comments>http://mschuette.name/wp/2008/04/google-summer-of-code/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 23:52:49 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[english]]></category>
		<category><![CDATA[GSoC08]]></category>
		<category><![CDATA[Syslog]]></category>

		<guid isPermaLink="false">http://mschuette.name/wp/?p=66</guid>
		<description><![CDATA[Today the participants in Google&#8217;s Summer of Code 2008 were announced. &#8211; And my project was chosen. :-) So now I will work for NetBSD and implement the new IETF syslog protocols.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.netbsd.org/"><img class="alignleft" style="float: left;" src="http://mschuette.name/wp/wp-upload/NetBSD-smaller-old.jpg" alt="NetBSD Logo" width="245" height="243" /></a></p>
<p>Today the participants in <a href="http://code.google.com/soc/2008/">Google&#8217;s Summer of Code 2008</a> were announced. &#8211; And <a href="http://code.google.com/soc/2008/netbsd/appinfo.html?csaid=B5296DDFACC3E192">my project</a> was chosen. :-)</p>
<p>So now I will work for <a href="http://www.netbsd.org/">NetBSD</a> and implement the new <a href="http://tools.ietf.org/wg/syslog/">IETF syslog protocols</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mschuette.name/wp/2008/04/google-summer-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

