From patchwork Wed Apr 8 18:25:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Etienne Champetier X-Patchwork-Id: 459415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 356D914011D for ; Thu, 9 Apr 2015 04:25:33 +1000 (AEST) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A15C92802BA; Wed, 8 Apr 2015 20:24:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 717012802BA for ; Wed, 8 Apr 2015 20:24:24 +0200 (CEST) X-policyd-weight: using cached result; rate:hard: -8.5 Received: from ns3354555.champetier.me (ns3354555.champetier.me [37.187.20.53]) by arrakis.dune.hu (Postfix) with ESMTP for ; Wed, 8 Apr 2015 20:24:20 +0200 (CEST) Received: by ns3354555.champetier.me (Postfix, from userid 1000) id E31C23803268; Wed, 8 Apr 2015 20:25:05 +0200 (CEST) From: Etienne CHAMPETIER To: John Crispin , OpenWrt Development List Date: Wed, 8 Apr 2015 20:25:04 +0200 Message-Id: <1428517504-15560-1-git-send-email-champetier.etienne@gmail.com> X-Mailer: git-send-email 2.1.0 Subject: [OpenWrt-Devel] [PATCH] ubox: add log_trailer_null option to uci X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" this allow us to use syslog tcp with \0 trailer instead of \n trailer (logread -0 option) Signed-off-by: Etienne CHAMPETIER --- package/system/ubox/files/log.init | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package/system/ubox/files/log.init b/package/system/ubox/files/log.init index 3e06fa5..4fc00d5 100644 --- a/package/system/ubox/files/log.init +++ b/package/system/ubox/files/log.init @@ -18,6 +18,7 @@ validate_log_section() 'log_remote:bool:1' \ 'log_port:port:514' \ 'log_proto:or("tcp", "udp"):udp' \ + 'log_trailer_null:bool:0' \ 'log_prefix:string' } @@ -63,7 +64,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 + local log_ip log_port log_proto log_prefix log_remote log_trailer_null validate_log_section "${1}" || { echo "validation failed" @@ -74,7 +75,10 @@ start_service_remote() procd_open_instance procd_set_param command "$PROG" -f -r "$log_ip" "${log_port}" -p "$pid_file" - [ "${log_proto}" != "udp" ] || procd_append_param command -u + case "${log_proto}" in + "udp") procd_append_param command -u;; + "tcp") [ "${log_trailer_null}" -eq 1 ] && procd_append_param command -0;; + esac [ -z "${log_prefix}" ] || procd_append_param command -P "${log_prefix}" procd_close_instance }