uci_validate_section system system "${1}" \
'log_file:string' \
'log_size:uinteger' \
+ 'log_hostname:string' \
'log_ip:ipaddr' \
'log_remote:bool:1' \
'log_port:port:514' \
{
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
+ local log_ip log_port log_proto log_prefix log_remote log_trailer_null log_hostname
validate_log_section "${1}" || {
echo "validation failed"
}
[ "${log_remote}" -ne 0 ] || return
[ -z "${log_ip}" ] && return
+ [ -z "${log_hostname}" ] && log_hostname=$(cat /proc/sys/kernel/hostname)
procd_open_instance
- procd_set_param command "$PROG" -f -r "$log_ip" "${log_port}" -p "$pid_file"
+ procd_set_param command "$PROG" -f -h "$log_hostname" -r "$log_ip" "${log_port}" -p "$pid_file"
case "${log_proto}" in
"udp") procd_append_param command -u;;
"tcp") [ "${log_trailer_null}" -eq 1 ] && procd_append_param command -0;;