[strongSwan] How to change group names in syslog

Tobias Brunner tobias at strongswan.org
Fri Apr 20 09:28:36 CEST 2012


Hi Terry,

> If sys_logger.c is the right place, could I just increase the group string size
> and add the suffix to pattern like this:
> 
> snprintf(groupstr, sizeof(groupstr), "%N-MS", debug_names, group);

That depends on the logging you want.  If you want to log to syslog then
yes that file is the right place and you can, of course, also add that
string right in there (either in the syslog() call or in the snprintf()
call above).  Other options to change the log lines for syslog are to
add an openlog() call in the sys_logger_t constructor (or in charon
during initialization).  This allows you to prepend a custom
identification to each log line, for instance:

	openlog("charon-MS", 0, 0);

I actually just pushed a commit (see [1]) that allows to set this string
via strongswan.conf.

If you also use any file loggers (charon.filelog in strongswan.conf, see
[2]) you can use the time_format option to change the prefix added to
each log line, for instance:

	time_format = %b %e %T charon-MS

> I tried this but didn't see any effect, but maybe because I didn't
> install everything.  Which binary
> needs to be rebuilt and installed when I changed sys_logger.c?

You have to rebuild and reinstall libcharon.

Regards,
Tobias

[1] http://git.strongswan.org/?p=strongswan.git;a=commitdiff;h=5895c2e9
[2] http://wiki.strongswan.org/projects/strongswan/wiki/LoggerConfiguration




More information about the Users mailing list