[syslog-ng] Creating a "log" block (OSE 3.2.1)
Balazs Scheidler
bazsi at balabit.hu
Thu Dec 9 21:21:15 CET 2010
On Wed, 2010-12-08 at 09:37 -0800, Eric Berggren wrote:
> > thanks for noticing this error. I've corrected it in the source repo of the
> > adminguide, and will update the docs on the website when someone tells me if
> > using {} within blocks is permitted (but now buggy) or forbidden.
>
> > changing the type of the block to root should workaround the problem.
>
> I see, it's really about using { }'s within the block definition. Making it a "root" block (as a completely separately log {} stanza) is probably cleaner in this particular case, but the same restriction applies at the moment -- the example from the OSE 3.2 documentation [5.3.2]:
>
> block root mylogs() {
> source s_file { file("/var/log/mylogs.log" follow_freq(1)); };
> destination d_local { file("/var/log/messages"); };
> log { source(s_file); destination(d_local); };
> };
>
> doesn't parse either (same error on the final "};")
>
> The documentation (html/PDF) could use some minor updates in this area for clarity:
>
> - block definitions also require ()'s after the name (including non-parameterized); e.g. block root foo() { ... }
> - perhaps add an additional example for using parameterized blocks; e.g.
> block destination foo ( logname("some.log") ) {
> file( "/var/log/`logname`" ... );
> };
> destination bar {
> foo( logname("other.log") )
> };
> destination baz {
> foo()
> };
>
> regards,
> -eric
> ps: I have yet to actually *test* any of this new functionality myself yet (later today :)
>
hi,
I've just committed these 3 patches that implement block support for
block statements. I've also resolved the '{' issue and also made it
possible to use several ';' characters in place of a single one.
I believe it is now possible to do what you originally wanted.
These are the patches:
commit ab88791c912bcba7b5ee9803682317404ea116cd
Author: Balazs Scheidler <bazsi at balabit.hu>
Date: Thu Dec 9 21:19:08 2010 +0100
blocks: make it possible to use blocks inside log statements
The original block implementation lacked support for blocks inside
log statements. This patch addresses that, by creating the "log"
context for blocks.
This is how to use it:
block log logblock() {
destination(something);
flags(flow-control);
};
log {
logblock();
};
Reported-By: Eric Berggren
Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>
commit 4d9f15ec70c86aace491527791b4304693f0222b
Author: Balazs Scheidler <bazsi at balabit.hu>
Date: Thu Dec 9 21:18:57 2010 +0100
blocks: allow the use of '{' character inside blocks
This was an omission in one of the lexer rules, but with this fix it works fine.
Reported-By: Eric Berggren
Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>
commit c2dbe6316c9b3afc7ff930c9ffa4cf190a699a09
Author: Balazs Scheidler <bazsi at balabit.hu>
Date: Thu Dec 9 21:18:30 2010 +0100
log statements: allow several semicolons instead of one
In order to introduce block support within "log" statements, it is convinient
to allow several ';' everywhere where only one was permitted.
This is needed in order to make it possible to close a statement inside
a block with a ';', and then also use a ';' at the end of a block reference.
This is more readable.
Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>
--
Bazsi
More information about the syslog-ng
mailing list