[syslog-ng] Creating a "log" block (OSE 3.2.1)

Balazs Scheidler bazsi at balabit.hu
Thu Dec 9 08:41:37 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 :)

Ahh.. this is an independent bug, fixed by this patch:

diff --git a/lib/cfg-lex.l b/lib/cfg-lex.l
index 34881c6..af4a715 100644
--- a/lib/cfg-lex.l
+++ b/lib/cfg-lex.l
@@ -254,7 +254,7 @@ word        [^ \#'"\(\)\{\}\\;\n\t,|\.@:]
 
                            }
 
-<block_content>[^}\"\'\n\r]+   { g_string_append(yyextra->string_buffer, yytext); }
+<block_content>[^{}\"\'\n\r]+   { g_string_append(yyextra->string_buffer, yytext); }
 
 <INITIAL><<EOF>>           { if (!cfg_lexer_start_next_include(yyextra)) yyterminate(); }
 


So, the only issue is to solve the multiple ';' problem (although that
can be worked around) and you'd have what you aim at.

-- 
Bazsi




More information about the syslog-ng mailing list