[syslog-ng] Message length

Balazs Scheidler bazsi at balabit.hu
Thu Jan 8 21:17:03 CET 2009


On Mon, 2009-01-05 at 13:14 +0100, G. Rayot wrote:
> The file test.log is the input for logger:
> $ logger -f test.log -p local6.info -t TEST
> 
> The result is given by the file local6.log
> As you can see, the part : " log. hello this is the second "is missing
> (31 characters). The syslog header is 31 char long.
> 
> I've also post the result of the strace (strace.txt). The useful part
> seems to be at line 119:
> send(1, "<182>Jan  5 13:04:01 TESTSAP: Fi"..., 1053, MSG_NOSIGNAL) =
> 1053
> time(NULL)                              = 1231157041
> stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=1920, ...}) =
> 0
> send(1, "<182>Jan  5 13:04:01 TESTSAP: lo"..., 66, MSG_NOSIGNAL) = 66
> read(0, "", 4096)                       = 0
> close(1)                                = 0
> 

logger seems to use an 1024 byte buffer for its input buffer and is
truncating your lines because of that.

You don't have to use logger though, it's quite simple to write a client
in perl/python or use OpenBSD netcat which supports UNIX domain sockets:

echo log-with-header | nc -U /dev/log

$ apt-cache show netcat-openbsd
Package: netcat-openbsd
Priority: optional
Section: net
Installed-Size: 168
Maintainer: Ubuntu MOTU Developers <ubuntu-motu at lists.ubuntu.com>
Original-Maintainer: Decklin Foster <decklin at red-bean.com>
Architecture: amd64
Version: 1.89-3ubuntu1
Replaces: netcat (<< 1.10-35)
Provides: netcat
Depends: libc6 (>= 2.4), libglib2.0-0 (>= 2.12.0)
Conflicts: netcat (<< 1.10-35)
Filename:
pool/main/n/netcat-openbsd/netcat-openbsd_1.89-3ubuntu1_amd64.deb
Size: 37142
MD5sum: 7e36f21e8406ff91238f7f58c2c2a907
SHA1: 94c357d349efc62cdbe8639708e37937c30cb209
SHA256: 068c6ca33db3a7bc801095b2cffe1a6cfcc98ed876c6da3ac18ff8c51fa88832
Description: TCP/IP swiss army knife
 A simple Unix utility which reads and writes data across network
 connections using TCP or UDP protocol.  It is designed to be a reliable
 "back-end" tool that can be used directly or easily driven by other
 programs and scripts. At the same time it is a feature-rich network
 debugging and exploration tool, since it can create almost any kind of
 connection you would need and has several interesting built-in
 capabilities.
 .
 This package contains the OpenBSD rewrite of netcat, including support
 for IPv6, proxies, and Unix sockets.
Bugs: mailto:ubuntu-users at lists.ubuntu.com
Origin: Ubuntu
Task: virt-host




-- 
Bazsi




More information about the syslog-ng mailing list