summaryrefslogtreecommitdiff
path: root/package/system
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2016-05-06 21:05:41 +0200
committerJo-Philipp Wich <jo@mein.io>2016-05-10 10:43:17 +0200
commita4571b7631e48e4beea1fe84a09679dfa9f2291a (patch)
tree7233d04688cb77e3536a334c8170094b3b8c8b28 /package/system
parentc3cf3c4ec4849f0594b5b7ffcb3502e5c28564b4 (diff)
downloadmtk-20170518-a4571b7631e48e4beea1fe84a09679dfa9f2291a.zip
mtk-20170518-a4571b7631e48e4beea1fe84a09679dfa9f2291a.tar.gz
mtk-20170518-a4571b7631e48e4beea1fe84a09679dfa9f2291a.tar.bz2
ubox: make logging code honour the hostname properly
Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'package/system')
-rw-r--r--package/system/ubox/files/log.init6
1 files changed, 4 insertions, 2 deletions
diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init
index 4fc00d5..53c936e 100644
--- a/package/system/ubox/files/log.init
+++ b/package/system/ubox/files/log.init
@@ -14,6 +14,7 @@ validate_log_section()
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' \
@@ -64,7 +65,7 @@ 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
+ local log_ip log_port log_proto log_prefix log_remote log_trailer_null log_hostname
validate_log_section "${1}" || {
echo "validation failed"
@@ -72,9 +73,10 @@ start_service_remote()
}
[ "${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;;