Is there any way I can redirect netifd logs to some file in /tmp and rotate them based on requirement.
Package syslog-ng
I have already enabled logd package for syslog logging and its working fine. Not sure I can enable syslog-ng
Sure you can. I use both logd and syslog-ng.
logd because this allows me to use Luci functionality to view the system log in the web interface and syslog-ng as this lets me separate out log messages using filters and log them to different files on a local disk as well as send the logs to a remote logstash server
Here's a cut down version of my syslog-ng.conf that you can use to get started.
@version: 3.30
options {
chain_hostnames(no);
stats_freq(43200);
keep_hostname(yes); # Enable or disable hostname rewriting.
log_msg_size(1024); # Maximum length of a message in bytes.
flush_lines(0); # How many lines are flushed to a destination at a time.
use_fqdn(no); # Add Fully Qualified Domain Name instead of short hostname.
};
source s_messages {
internal(); # collect internal syslog messages on this stream
unix-dgram("/dev/log");
};
source s_kernel {
file("/dev/kmsg" program_override("kernel") default-facility("kern") flags("kernel"));
};
destination d_messages {
file("/var/log/messages");
};
destination d_kernel {
file("/var/log/kernel");
};
filter f_kernel {
program("kernel") and not level(debug);
};
log {
source(s_kernel);
destination(d_kernel);
flags(final);
};
log {
source(s_messages);
destination(d_messages);
flags(fallback);
};