From nobody Wed May 8 07:12:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642528596; cv=none; d=zohomail.com; s=zohoarc; b=HXJx8hH/QdhYT1VBpuAJuKKMwvmBp9dAVRIHylWwTAAp8UMzPOX6yIoTbyx9Me+54bQWlMyd6hcIKFpL4TLO7Dx6Nfa6BLNmlegxKJL4hHfSkw4X3GkRrcH28PTdxI9rgmeMH9hnmDXNthx58vrnkjr1LXc8kOJHSFtjdv364bA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642528596; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QEFpV6ON131CekhDjSlpCFQQ0bhbz0+zx7+NkbtA8Yc=; b=BSRTOMy94YmMuSMv5jBCcDetlcg1+AFvgXdSRlXZaHuk3NrB8YGqb8G9h+bUw2QffG0L1M/2GT/kD4erJ1EEAWHFoZTcQUiArLr1q4xGvI0H49XldDQTuDhLiraKqKBSQDntLzhrDBTGggEfBPXGOQaLaXcEddvyNgIENcvCYfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1642528596192622.9212905587389; Tue, 18 Jan 2022 09:56:36 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-32-tR8zOg0LNZ62Cqeq7h5gag-1; Tue, 18 Jan 2022 12:56:16 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B609D81F02B; Tue, 18 Jan 2022 17:53:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 678E27E21A; Tue, 18 Jan 2022 17:53:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BFC9A4A705; Tue, 18 Jan 2022 17:53:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20IGn4e7003836 for ; Tue, 18 Jan 2022 11:49:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id C89F15AB46; Tue, 18 Jan 2022 16:49:04 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.195.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01E27B0D5C; Tue, 18 Jan 2022 16:49:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642528595; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QEFpV6ON131CekhDjSlpCFQQ0bhbz0+zx7+NkbtA8Yc=; b=Mhotlz3WTGioSsfw5Hm/TV4Jlr7+hr3E4bxRNDA38bEqkkmmdt9VG4Bhb8I7CYkyKOuGJe akXkNzhIBazQp8hwWhiqt51wYnnsIKe3P1vA3WGKRvY0mokW6omAq6xb/gHYTY18UvcIMu EZDEkQs5QLdJc/bvtuaBsTjSitW+rTg= X-MC-Unique: tR8zOg0LNZ62Cqeq7h5gag-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] util: fix syslog facility value Date: Tue, 18 Jan 2022 16:49:00 +0000 Message-Id: <20220118164901.383860-2-berrange@redhat.com> In-Reply-To: <20220118164901.383860-1-berrange@redhat.com> References: <20220118164901.383860-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642528598204100001 We set SYSLOG_PRIORITY when sending to journald to avoid our messages getting tagged with the default facility which is used for the kernel. Unfortunately: commit fd00f0e6c75b00c3d97be8670afcd9094b823855 Author: Guido G=C3=BCnther Date: Mon Sep 21 20:06:55 2015 +0200 Use daemon log facility for journald used the LOG_nnn constants from the syslog header without realizing that these values have a bit-shift applied. While Linux defines a LOG_FAC() macros to undo the bit-shift this doesn't appear to be standardized. So the safe thing is to just use the raw value since these values are fixed by RFC 5424. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virlog.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index b44ad0ef6c..72b0613dfb 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -925,7 +925,13 @@ virLogOutputToJournald(virLogSource *source, journalAddString(&state, "MESSAGE", rawstr); journalAddInt(&state, "PRIORITY", virLogPrioritySyslog(priority)); - journalAddInt(&state, "SYSLOG_FACILITY", LOG_DAEMON); + /* See RFC 5424 section 6.2.1 + * + * Don't use LOG_nnn constants as those have a bit-shift + * applied for use with syslog() API, while journald + * needs the raw value + */ + journalAddInt(&state, "SYSLOG_FACILITY", 3); journalAddString(&state, "LIBVIRT_SOURCE", source->name); if (filename) journalAddString(&state, "CODE_FILE", filename); --=20 2.33.1 From nobody Wed May 8 07:12:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642528720; cv=none; d=zohomail.com; s=zohoarc; b=ddO7cQh1hil1NY5QyWwpSigFfRoH2YfBl4tBIVzWkMqF2+LOqr6reoNkwGxJHMfLXph2yzxr/9TJl+77RSlnV3JFuSEoPyVX2G3SQgLnmK8YuxR+2XbpojCLxt0Z1pwHAOIT1KMSxkMsiRLvVNSm58uDqiPhz0b7PNUOwom7wjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642528720; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iiNnb5Bpt9wUWOzpSfdLo1gvoK87sZ1g2pAIOYMb95k=; b=MpSYQw15AXlsCaU/UMdmWYYMbarrO/w0hD8ZtMFyDW1DsX/bIMLo07AoQ3Qupt5Qcy8y3sLIt4/dNyaP/DwafgwXa+wmzkuNJUMugE5QYPlYp/WLL5+i2IYwWe7xoHPCdgI3H6TXT7ZFtQhZFdR5cL7s8vru220leSn09MZa264= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1642528720746229.65102726433497; Tue, 18 Jan 2022 09:58:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-206-chiUXlY8P-KcLi1ck3iCPQ-1; Tue, 18 Jan 2022 12:58:37 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78EC618B9EEE; Tue, 18 Jan 2022 17:58:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2FF527E23A; Tue, 18 Jan 2022 17:58:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C8ED11826D07; Tue, 18 Jan 2022 17:58:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20IGn64j003846 for ; Tue, 18 Jan 2022 11:49:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A19A5AB48; Tue, 18 Jan 2022 16:49:06 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.39.195.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F88E5AB46; Tue, 18 Jan 2022 16:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642528719; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iiNnb5Bpt9wUWOzpSfdLo1gvoK87sZ1g2pAIOYMb95k=; b=I7rBjUeXvlx2w/PLT6zlQT0t22cC7VSRpxZi59rRSown8moioKoC9DbniMRpT5VQ87Gdy+ NndBqgkrjM3zFjANhhwhge0NFHNjyxnE8wRh0QgoaMGsgJ6Ws9NpaMkGjCkmFY2RZMPrPR H+SCDgl+xE8UQqrOONMs1tLyJTQSQ+4= X-MC-Unique: chiUXlY8P-KcLi1ck3iCPQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] util: set facility when opening syslog channel Date: Tue, 18 Jan 2022 16:49:01 +0000 Message-Id: <20220118164901.383860-3-berrange@redhat.com> In-Reply-To: <20220118164901.383860-1-berrange@redhat.com> References: <20220118164901.383860-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642528721524100001 We're currently passing '0' which leaves the syslog facility unset. Since we're passing an explicit facility for syslog when using journald, it makes sense to be explicit when using syslog directly too. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/util/virlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index 72b0613dfb..443e948917 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1412,7 +1412,7 @@ virLogDefineOutputs(virLogOutput **outputs, size_t no= utputs) tmp =3D g_strdup(outputs[id]->name); VIR_FREE(current_ident); current_ident =3D tmp; - openlog(current_ident, 0, 0); + openlog(current_ident, 0, LOG_DAEMON); } #endif /* WITH_SYSLOG_H */ =20 --=20 2.33.1