How to modify syslog output format in busybox?

austinc picture austinc · Jan 9, 2015 · Viewed 11k times · Source

How to modify syslog output format in busybox? For example:

Jan 1 00:00:42 LSM user.info root: Hello

to

Jan 1 [IP] LSM user.info root: Hello

I try using template in syslog.conf but it not works. ref. http://goo.gl/tcDbzZ

$template precise,"%syslogpriority%,%syslogfacility%,%timegenerated%,%HOSTNAME%,%syslogtag%,%msg%\n"
$ActionFileDefaultTemplate precise

Or should I modify the syslog.c in src? Is there a better way to achieve this work?

Thanks for your help and kindness.

Answer

Mali picture Mali · Jan 9, 2015

syslog in busybox has an option FEATURE_SYSLOGD_CFG which can enable/disable at compile time the support of syslog.conf.

Note that it is surely a restricted support compared to "standard" syslog.conf.

check if this option is enabled with make menuconfig