Purpose:
The following procedure summarizes how conditional rewrite rules (rewrite rules that have the condition() parameter set) work. The following configuration snippet is used to illustrate the procedure:
rewrite r_rewrite_set{ set( "myhost", value("HOST") condition(program("myapplication")) ); }; log { source(s1); rewrite(r_rewrite_set); destination(d1); };
Steps:
-
The log path receives a message from the source (s1).
-
The rewrite rule (r_rewrite_set) evaluates the condition. If the message matches the condition (the PROGRAM field of the message is "myapplication"), syslog-ng OSE rewrites the log message (sets the value of the HOST field to "myhost"), otherwise it is not modified.
-
The next element of the log path processes the message (d1).