Syslog-ng logs storing with hostname year date

mikrotiksyslog-ngubuntu-12.04

I have syslog-ng on Ubuntu 12.4 to store mikrotik router logs. At a moment its working fine and log gets stored in a file i set.
Howto add store logs in a file/folder according to source IP so that each log file name may contain month year as well auto. My current config is as follows.

# Accept connection on UDP
source s_net { udp (); };
# Add Filter to add our mikrotik
filter f_mikrotik { host( "10.0.0.1" ); };
# Add destination file where logs will be stored
destination df_mikrotik { file("/var/log/mikrotik/mikrotik.log"); };
log { source ( s_net ); filter( f_mikrotik ); destination ( df_mikrotik ); };

Best Answer

You want to use macros in your destination path or filename, for example: file("/var/log/${YEAR}.${MONTH}.${DAY}/messages"

For details, see the list of syslog-ng macros