Re: [syslog-ng] Writing to a named Pipe
The patch worked. Is there any way to create the pipes on the fly? Date: Thu, 22 Jan 2009 19:39:48 +0100 From: Balazs Scheidler <bazsi@balabit.hu> Subject: Re: [syslog-ng] Writing to a named Pipe To: Syslog-ng users' and developers' mailing list <syslog-ng@lists.balabit.hu> Message-ID: <1232649588.15998.177.camel@bzorp.balabit> Content-Type: text/plain On Thu, 2009-01-22 at 15:26 +0000, Pedro Rafael Alves Simoes wrote:
Hello,
In my syslog-ng configuration I'm writing messages to named pipes which name is given dynamically by the $PRI macro:
destination d_test { pipe("/tmp/$PRI.log"); };
All the possible PRI.log pipes were created previously with mkfifo.
With this configuration the messages aren't being written to the pipes. It simply does nothing. Doing a strace on the syslog-ng process, it shows an error :
open("/tmp/$PRI.log", O_RDWR|O_NONBLOCK|O_NOCTTY|O_LARGEFILE) = -1 ENOENT (No such file or directory)
It seems that the PRI macro isn't being interpolated in the string.
well, the pipe() driver does not support macros, thus it uses the string literally. More exactly the pipe driver explicitly disallows that. Since I don't remember exactly why I did this, here's a patch that removes the restriction. Please let me know how it works out for you, if it seems to work, I'm also willing to integrate it. Patch is against OSE 3.0, but is trivial to backport to 2.1 diff --git a/src/cfg-grammar.y b/src/cfg-grammar.y index 761bb56..fdfa18f 100644 --- a/src/cfg-grammar.y +++ b/src/cfg-grammar.y @@ -801,7 +801,7 @@ dest_afpipe dest_afpipe_params : string { - last_driver = affile_dd_new($1, AFFILE_NO_EXPAND | AFFILE_PIPE); + last_driver = affile_dd_new($1, AFFILE_PIPE); free($1); last_writer_options = &((AFFileDestDriver *) last_driver)->writer_options; last_writer_options->flush_lines = 0; -- Bazsi
Hi, We were looking at migrating our system to use syslog-ng 3.0.1 and found that with our configuration we ended up with duplicated log messages. After some investigation this turned out to be a problem in the way templates were compiled. Attached is a patch that addresses this. Thanks, Chris
On Mon, 2009-02-02 at 11:18 +1300, chris packham wrote:
Hi,
We were looking at migrating our system to use syslog-ng 3.0.1 and found that with our configuration we ended up with duplicated log messages. After some investigation this turned out to be a problem in the way templates were compiled.
Attached is a patch that addresses this.
you are right, but the same issue was reported the Peter Eckel. I've fixed this as a reply to his message, and also pushed a similar patch: commit 60aeab750e952b3a69714ea47e2aa31683c761fd Author: Balazs Scheidler <bazsi@balabit.hu> Date: Thu Feb 5 10:50:45 2009 +0100 fixed the references for non-inline templates this patch fixes template expansion for non-inline templates. The parser code caused these templates to be compiled as many times as they were referenced, which in turn concatenated the previously compiled value and the currently compiled value. -- Bazsi
On Tue, 2009-01-27 at 12:06 +0000, Pedro Rafael Alves Simoes wrote:
The patch worked. Is there any way to create the pipes on the fly?
I've just pushed these patches to syslog-ng 3.0 repository: commit 44fbc3f955755d6772f5a8919b647d61b10bccd5 Author: Balazs Scheidler <bazsi@balabit.hu> Date: Thu Feb 5 11:09:17 2009 +0100 [affile] allow the use of macros in the case of named pipes previously syslog-ng did not allow the use of templates in naming destination named pipes. now it can do that. commit 5f5d4bd914798c10eef01f6baaf575bc0e3c1557 Author: Balazs Scheidler <bazsi@balabit.hu> Date: Thu Feb 5 11:08:11 2009 +0100 [affile] make it possible to create named pipes As reported on the mailing list, syslog-ng is not currently capable of creating named pipes on its own. This patch will make syslog-ng autocreate pipes when needed. With these, I think you can accomplish what you want. Tomorrow's nightly snapshot should contain these. -- Bazsi
participants (3)
-
Balazs Scheidler
-
chris packham
-
Pedro Rafael Alves Simoes