Set hostname, timezone & log_ip in /etc/config/system (log_ip is of staging server)
config system
option hostname 'pocha'
option timezone 'IST-5:30'
option log_ip 52.220.125.81
timezone & log_ip can be put from the firmware. hostname can be created as ssid-gid during the setup process. uci command could be used to set hostname
uci set system.@system[0].log_ip=192.168.1.2
uci commit
/etc/init.d/log need to be modified a bit. It does not attach hostname in the remote logs.
Add hostname
as shown below (at multiple locations)
validate_log_section()
{
uci_validate_section system system "${1}" \
'log_file:string' \
'log_size:uinteger' \
'log_ip:ipaddr' \
'log_remote:bool:1' \
'log_port:port:514' \
'log_proto:or("tcp", "udp"):udp' \
'log_trailer_null:bool:0' \
'log_prefix:string' \
'hostname:string'
}
.
.
start_service_remote()
{
PIDCOUNT="$(( ${PIDCOUNT} + 1))"
local pid_file="/var/run/logread.${PIDCOUNT}.pid"
local log_ip log_port log_proto log_prefix log_remote log_trailer_null hostname
.
.
procd_open_instance
procd_set_param command "$PROG" -f -r "$log_ip" "${log_port}" -p "$pid_file" -h "$hostname"
Thats it. The logs will now appear inside /var/log/griggi/<hostname>.log
in the remote syslog server.
This change can be incorporated in firmware itself if the init file is same for all images.
Part below is already done & mentioned just for reference purpose
To configure rsyslog on a remote server, install rsyslogd
Uncomment & add (as required) lines in /etc/rsyslog.d
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514
$PreserveFQDN on
$template TmplAuth, "/var/log/griggi/%HOSTNAME%.log"
.
.
#*.info;mail.none;authpriv.none;cron.none /var/log/messages
*.info;mail.none;authpriv.none;cron.none ?TmplAuth