From patchwork Tue Apr 18 18:45:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Roevens X-Patchwork-Id: 6794 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Q1CYF4QmXz3xGJ for ; Tue, 18 Apr 2023 18:45:53 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Q1CY90VN5z9QV; Tue, 18 Apr 2023 18:45:49 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Q1CY8420cz30J0; Tue, 18 Apr 2023 18:45:48 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Q1CY65j99z2xKQ for ; Tue, 18 Apr 2023 18:45:46 +0000 (UTC) Received: from knopi.disroot.org (knopi.disroot.org [178.21.23.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPS id 4Q1CY540Gpz2yc for ; Tue, 18 Apr 2023 18:45:45 +0000 (UTC) Authentication-Results: mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b="QrD7/aL7"; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Seal: i=1; s=202003rsa; d=lists.ipfire.org; t=1681843546; a=rsa-sha256; cv=none; b=sv3YtoNUSWedLBkUVg2xW97kRB/aLaa5vt/vfs0cLREW42yfrzFP/0R4XFik1nBcJ/wmwd Cun6VG6vYLdcyhIe/md1Fca5+XWssN2O9iGZ/ml4R941vhZPtxOT4QJWn3nCIQbdP6CMys PevdVPe6E4jYTuxpZRxRcXBbHzQ0ABqXiXwWhE4vASTrI4SIyrYOr1JEGKnsC4M3oFX0Bx f6UsQV9YeCnwwihgj8NBqES1Aatg2PVliCxVh3Jj1JbBF9MdnHqbTSoWlnfiFI9gQuwl3+ reoSXVdgyJ1B3kdldD79uh7/30l/QdpTYWWVgwC5ENQ3fLQpmgtUxx86todxGg== ARC-Authentication-Results: i=1; mail01.ipfire.org; dkim=pass header.d=disroot.org header.s=mail header.b="QrD7/aL7"; spf=pass (mail01.ipfire.org: domain of robin.roevens@disroot.org designates 178.21.23.139 as permitted sender) smtp.mailfrom=robin.roevens@disroot.org; dmarc=pass (policy=reject) header.from=disroot.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ipfire.org; s=202003rsa; t=1681843546; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qv5vK5fOqftwgK0GMvOFB/wLnQxH9Cyz54HYEcLbo4s=; b=wAij9loV+m9eBSi8OeGsOC2YSSeiBUg+8dczxEYb4+XptProVmZgUr3HiDYoQhUZRRqV67 WQ36KcfT2nIIGUoZHoGZ3jx4qp+VPgEwGlxb8wwCz7HaL7wy5T/ZgUZNnnB4zQunCze4Nn uKIDTKHfAQ1eE1ntGFY6CxWO+80X6d2gBNK+jXVBBApDcTXe/GXg5dXi4BA0YBL2W3pTRC P2JuQWP4OevCekGRaucADxMXYjvJJ+vehy3iofpu7e3Hio4XUVM1/RBKM7fB/3uzKvJn5q 1GE7R9IiGfq0lZjT4q4Q1i4pSheIw0bm7hzvBMxbCY0al3eGkXgHo+cOU9Xmkg== Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id D487140619 for ; Tue, 18 Apr 2023 20:45:44 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Q0j-AJpAyFS for ; Tue, 18 Apr 2023 20:45:43 +0200 (CEST) Received: from chojin.sicho.home (amaterasu.sicho.home [192.168.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (no client certificate requested) (Authenticated sender) by hachiman (MailScanner Milter) with SMTP id F3F4BD0BD0; Tue, 18 Apr 2023 20:45:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1681843543; bh=TdUTZZNObIq5dVTvTZcBQzfh3A+KzWLTFP0OgPzQq/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QrD7/aL7GGVFvZBQIXrAC06K8ySfmlRjJ1/7GBiSHfxdGr/Rgi4PdxID+SUo4Q8Of zuOTDLhGiBEW1On0Uz51Ptt3GY/OVF1khtJ5l/0rEtcDHSv4qXwxIPPfcZkNIvruK2 DjRJzyJZJGG75zGx0ZlC76ZNfeyHukQvuaN7ZHu+ocKfYhHZW0bLUZ3JifxfBF+68e oAiTiQFATaN+TKfqsiHviFuDIe/R/NnLmq7Up15NORjwrN6CoKw6dKS3NXWOWFOVJZ 8uqkqWkrKQg0xwpjEa52vB2bJhAmIlJRXhK5pJZZBJqcvm0TJEZJQpVPXpGXnualYC z5RwXeG7nfOGA== From: Robin Roevens To: development@lists.ipfire.org Subject: [PATCH v2 3/3] Add Zabbix Agent to logviewer Date: Tue, 18 Apr 2023 20:45:12 +0200 Message-Id: <20230418184512.2235-4-robin.roevens@disroot.org> In-Reply-To: <20230418184512.2235-1-robin.roevens@disroot.org> References: <20230418184512.2235-1-robin.roevens@disroot.org> MIME-Version: 1.0 X-sicho-MailScanner-ID: F3F4BD0BD0.A8A80 X-sicho-MailScanner: Found to be clean X-sicho-MailScanner-From: robin.roevens@disroot.org X-sicho-MailScanner-Watermark: 1682448327.10004@+LN+6wMitQn1tML1R1L+vQ X-Rspamd-Action: no action X-Rspamd-Server: mail01.haj.ipfire.org X-Rspamd-Queue-Id: 4Q1CY540Gpz2yc X-Spamd-Result: default: False [-1.65 / 11.00]; BAYES_HAM(-3.00)[99.99%]; SPF_REPUTATION_SPAM(1.86)[0.61852363191687]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM(-0.99)[-0.992]; DMARC_POLICY_ALLOW(-0.50)[disroot.org,reject]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[disroot.org:s=mail]; R_SPF_ALLOW(-0.20)[+a]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; IP_REPUTATION_HAM(-0.01)[asn: 50673(0.00), country: NL(-0.01), ip: 178.21.23.139(0.00)]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; DKIM_REPUTATION(0.00)[0]; ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1]; ASN(0.00)[asn:50673, ipnet:178.21.23.0/24, country:NL]; RCVD_COUNT_THREE(0.00)[3]; RCPT_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[disroot.org:+]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[] X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" - Configure Zabbix Agent to log to syslog instead of its own logs. - Remove old zabbix log-dir and logrotate settings from rootfile, lfs and install-script. - Update log.dat to view Zabbix Agent logging from syslog. Signed-off-by: Robin Roevens --- config/rootfiles/packages/zabbix_agentd | 2 -- config/zabbix_agentd/logrotate | 9 --------- config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf | 5 ++--- html/cgi-bin/logs.cgi/log.dat | 6 ++++-- lfs/zabbix_agentd | 9 --------- src/paks/zabbix_agentd/install.sh | 4 +--- 6 files changed, 7 insertions(+), 28 deletions(-) delete mode 100644 config/zabbix_agentd/logrotate diff --git a/config/rootfiles/packages/zabbix_agentd b/config/rootfiles/packages/zabbix_agentd index 6f2c831d7..729a47ac6 100644 --- a/config/rootfiles/packages/zabbix_agentd +++ b/config/rootfiles/packages/zabbix_agentd @@ -1,4 +1,3 @@ -etc/logrotate.d/zabbix_agentd etc/rc.d/init.d/zabbix_agentd etc/sudoers.d/zabbix_agentd etc/sudoers.d/zabbix_agentd_user @@ -21,4 +20,3 @@ var/ipfire/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf var/ipfire/zabbix_agentd/userparameters var/ipfire/zabbix_agentd/userparameters/userparameter_pakfire.conf var/ipfire/zabbix_agentd/userparameters/userparameter_ipfire.conf -#var/log/zabbix diff --git a/config/zabbix_agentd/logrotate b/config/zabbix_agentd/logrotate deleted file mode 100644 index 83bbca9fb..000000000 --- a/config/zabbix_agentd/logrotate +++ /dev/null @@ -1,9 +0,0 @@ -/var/log/zabbix/zabbix_agentd.log { - monthly - rotate 12 - compress - delaycompress - missingok - notifempty - create 0640 zabbix zabbix -} diff --git a/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf b/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf index c6be948be..f6580f3ba 100644 --- a/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf +++ b/config/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf @@ -1,8 +1,7 @@ PidFile=/var/run/zabbix/zabbix_agentd.pid -# Log rotation is managed by logrotate -LogFile=/var/log/zabbix/zabbix_agentd.log -LogFileSize=0 +# Logs go to syslog so it can be viewed in WUI logviewer +LogType=system # These paths are included in the IPFire backups. Do not put user modules # or configuration files in other locations if you want them included in the diff --git a/html/cgi-bin/logs.cgi/log.dat b/html/cgi-bin/logs.cgi/log.dat index 53b9073fc..01c382a0d 100644 --- a/html/cgi-bin/logs.cgi/log.dat +++ b/html/cgi-bin/logs.cgi/log.dat @@ -78,7 +78,8 @@ my %sections = ( 'ssh' => '(sshd(?:\(.*\))?\[.*\]: )', 'unbound' => '(unbound: \[.*?\])(.*:.*$)', 'urlfilter bl' => '(installpackage\[urlfilter\]: )', - 'wireless' => '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:)' + 'wireless' => '(hostapd:|kernel: ath.*:|kernel: wifi[0-9]:)', + 'zabbix_agentd' => '(zabbix_agentd\[.*?\]: )' ); # Translations for the %sections array. @@ -112,7 +113,8 @@ my %trsections = ( 'ssh' => 'SSH', 'unbound' => 'DNS: Unbound', 'urlfilter bl' => 'URLFilter Blacklist', - 'wireless' => 'Wireless' + 'wireless' => 'Wireless', + 'zabbix_agentd' => 'Zabbix Agent' ); diff --git a/lfs/zabbix_agentd b/lfs/zabbix_agentd index 45f7cec1f..4f2a8b5d8 100644 --- a/lfs/zabbix_agentd +++ b/lfs/zabbix_agentd @@ -114,10 +114,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) # Create directory for additional agent modules -mkdir -pv /usr/lib/zabbix - # Create directory for logging - -mkdir -pv /var/log/zabbix - chown zabbix.zabbix /var/log/zabbix - # Create directory for pid. -mkdir -pv /var/run/zabbix chown zabbix.zabbix /var/run/zabbix @@ -135,10 +131,5 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) install -v -m 644 $(DIR_SRC)/config/backup/includes/zabbix_agentd \ /var/ipfire/backup/addons/includes/zabbix_agentd - # Install include file for Logrotate - -mkdir -pv /etc/logrotate.d - install -v -m 644 $(DIR_SRC)/config/zabbix_agentd/logrotate \ - /etc/logrotate.d/zabbix_agentd - @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/paks/zabbix_agentd/install.sh b/src/paks/zabbix_agentd/install.sh index 80632d1ec..e3f988c34 100644 --- a/src/paks/zabbix_agentd/install.sh +++ b/src/paks/zabbix_agentd/install.sh @@ -39,7 +39,6 @@ ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc0.d/K02zabbix_agentd ln -sf ../init.d/zabbix_agentd /etc/rc.d/rc6.d/K02zabbix_agentd # Create additonal directories and set permissions -[ -d /var/log/zabbix ] || ( mkdir -pv /var/log/zabbix && chown zabbix.zabbix /var/log/zabbix ) [ -d /usr/lib/zabbix ] || ( mkdir -pv /usr/lib/zabbix && chown zabbix.zabbix /usr/lib/zabbix ) restore_backup ${NAME} @@ -66,8 +65,7 @@ grep -q "Include=/var/ipfire/zabbix_agentd/zabbix_agentd_ipfire_mandatory.conf" if [ $? -eq 1 ]; then # Remove settings that are now in our own config sed -i -e "\|^PidFile=.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf - sed -i -e "\|^LogFile=.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf - sed -i -e "\|^LogFileSize=.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf + sed -i -e "\|^LogType=.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf sed -i -e "\|^LoadModulePath=.*$|d" /etc/zabbix_agentd/zabbix_agentd.conf sed -i -e "\|^Include=/etc/zabbix_agentd/zabbix_agentd\.d/\*\.conf$|d" /etc/zabbix_agentd/zabbix_agentd.conf # Include our own config in main config