@Butterfly Bones, I sometimes wonder about optimizing our filters. Our routers don't spit out log messages that fast, so I suppose it doesn't matter, but AND and OR filters take longer because the program has to read each message multiple times for that filter
The program function accepts a regexp, so your f_ovpnclient function could also read like this:
Code:
filter f_ovpnclient {
program("ovpn-client?", type(glob));
};
I think that would operate much faster (glob being much faster than regexp processing).
Another possibility is to screen messages like this:
Code:
filter f_ovpnclient {
program("ovpn-client?", type(glob));
};
filter f_ovpnserver{
program("ovpn-server?", type(glob));
};
filter f_ovpn {
program("ovpn*", type(glob));
};
log {
source(src);
filter(f_ovpn);
filter(f_ovpnserver);
destination(d_ovpnserver);
flags(final);
};
log {
source(src);
filter(f_ovpn);
filter(f_ovpnclient);
destination(d_ovpnclient);
flags(final);
};
I honestly don't know if that would be faster, but anything that doesn't come a program starting with ovpn won't get dealt with further, and only those starting with ovpn will get processed by the more complicated filters.
The other thing is to give more complex configuration files, or those for less frequent use, an alphabetic name lower in priority. Because syslog-ng applies configuration files to message alphabetically, and we are using the final function to stop processing a message, simple, frequent log messages can be stripped out in the beginning with first-in-order filters and don't have to pass on to others. Slower filters never get reached, and can be the last of the filters tried before a message drops to messages.