From nobody Sun Apr 28 23:56:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152424343130037.84152952252805; Fri, 20 Apr 2018 09:57:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 372CA7F6A0; Fri, 20 Apr 2018 16:57:09 +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 E1CB860BE1; Fri, 20 Apr 2018 16:57:08 +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 9467C4CAA1; Fri, 20 Apr 2018 16:57:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3KGuiBQ019447 for ; Fri, 20 Apr 2018 12:56:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73C8E11701C4; Fri, 20 Apr 2018 16:56:44 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE52E11701C6; Fri, 20 Apr 2018 16:56:43 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 20 Apr 2018 17:56:36 +0100 Message-Id: <20180420165639.8386-2-berrange@redhat.com> In-Reply-To: <20180420165639.8386-1-berrange@redhat.com> References: <20180420165639.8386-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 1/4] Revert "util: virlog: Introduce wildcard to log filters" 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 20 Apr 2018 16:57:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This reverts commit 8daa593b0741452a78daea76075254ae7d3c6ab6. There are two undesirable aspects to the impl - Only a bare wildcard is permitted - The wildcard match is not performed in the order listed --- src/remote/libvirtd.conf | 4 +--- src/util/virlog.c | 44 +------------------------------------------- src/util/virlog.h | 1 - 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/src/remote/libvirtd.conf b/src/remote/libvirtd.conf index 7d823cf1ad..9c0080dc06 100644 --- a/src/remote/libvirtd.conf +++ b/src/remote/libvirtd.conf @@ -368,9 +368,7 @@ # Multiple filters can be defined in a single @filters, they just need to = be # separated by spaces. Note that libvirt performs "first" match, i.e. if # there are concurrent filters, the first one that matches will be applied, -# given the order in log_filters with the exception of a wildcard filter, = since -# that's only taken into account if no other filter has matched, so -# "4:* 1:util.pci" and "1:util.pci 4:*" are equivalent definitions. +# given the order in log_filters. # # e.g. to only get warning or errors from the remote layer and only errors # from the event layer: diff --git a/src/util/virlog.c b/src/util/virlog.c index 81a9dc4395..5810643e1b 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -497,38 +497,6 @@ virLogHostnameString(char **rawmsg, return 0; } =20 -/* virLogFiltersFind: - * @filters: haystack - * @nfilters: haystack size - * @key1: primary string 'needle' - * @key2: secondary integer 'needle' - * - * Performs "first match" search on the input set of filters, using @key1 - * (string) and @key2 (integer) as primary and secondary keys respectivel= y. - * Secondary key is only considered if primary key wasn't provided. - * - * Returns a pointer to the matched object or NULL if no match was found. - */ -static virLogFilterPtr -virLogFiltersFind(virLogFilterPtr *filters, - size_t nfilters, - const char *key1, - unsigned int key2) -{ - size_t i; - - if (!key1 && key2 =3D=3D 0) - return NULL; - - for (i =3D 0; i < nfilters; i++) { - if ((key1 && STREQ(key1, filters[i]->match)) || - filters[i]->flags =3D=3D key2) - return filters[i]; - } - - return NULL; -} - =20 static void virLogSourceUpdate(virLogSourcePtr source) @@ -1441,8 +1409,7 @@ virLogFilterNew(const char *match, virLogFilterPtr ret =3D NULL; char *mdup =3D NULL; =20 - virCheckFlags(VIR_LOG_STACK_TRACE | - VIR_LOG_WILDCARD, NULL); + virCheckFlags(VIR_LOG_STACK_TRACE, NULL); =20 if (priority < VIR_LOG_DEBUG || priority > VIR_LOG_ERROR) { virReportError(VIR_ERR_INVALID_ARG, _("Invalid log priority %d"), @@ -1561,8 +1528,6 @@ virLogDefineOutputs(virLogOutputPtr *outputs, size_t = noutputs) int virLogDefineFilters(virLogFilterPtr *filters, size_t nfilters) { - virLogFilterPtr rc; - if (virLogInitialize() < 0) return -1; =20 @@ -1570,10 +1535,6 @@ virLogDefineFilters(virLogFilterPtr *filters, size_t= nfilters) virLogResetFilters(); virLogFilters =3D filters; virLogNbFilters =3D nfilters; - - /* if there's a wildcard filter, update default priority */ - if ((rc =3D virLogFiltersFind(filters, nfilters, NULL, VIR_LOG_WILDCAR= D))) - virLogDefaultPriority =3D rc->priority; virLogUnlock(); =20 return 0; @@ -1749,9 +1710,6 @@ virLogParseFilter(const char *src) match++; } =20 - if (STREQ(match, "*")) - flags |=3D VIR_LOG_WILDCARD; - /* match string cannot comprise just from a single '+' */ if (!*match) { virReportError(VIR_ERR_INVALID_ARG, diff --git a/src/util/virlog.h b/src/util/virlog.h index 07b91f0b0a..8973f83b20 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -174,7 +174,6 @@ typedef void (*virLogCloseFunc) (void *data); =20 typedef enum { VIR_LOG_STACK_TRACE =3D (1 << 0), - VIR_LOG_WILDCARD =3D (1 << 1) } virLogFlags; =20 int virLogGetNbFilters(void); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 23:56:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524243412663946.6236949186494; Fri, 20 Apr 2018 09:56:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 93A6426AC4C; Fri, 20 Apr 2018 16:56:50 +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 5FB985EDE0; Fri, 20 Apr 2018 16:56:50 +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 90FC21805972; Fri, 20 Apr 2018 16:56:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3KGujU4019455 for ; Fri, 20 Apr 2018 12:56:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 28AB511701C4; Fri, 20 Apr 2018 16:56:45 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id A256F11701C6; Fri, 20 Apr 2018 16:56:44 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 20 Apr 2018 17:56:37 +0100 Message-Id: <20180420165639.8386-3-berrange@redhat.com> In-Reply-To: <20180420165639.8386-1-berrange@redhat.com> References: <20180420165639.8386-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 2/4] log: rename virLogFlags to virLogFilterFlags to match docs 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 20 Apr 2018 16:56:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Erik Skultety --- src/util/virlog.c | 2 +- src/util/virlog.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index 5810643e1b..5262d613f6 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -87,7 +87,7 @@ VIR_ENUM_IMPL(virLogDestination, VIR_LOG_TO_OUTPUT_LAST, struct _virLogFilter { char *match; virLogPriority priority; - unsigned int flags; + unsigned int flags; /* bitwise OR of virLogFilterFlags */ }; =20 static int virLogFiltersSerial =3D 1; diff --git a/src/util/virlog.h b/src/util/virlog.h index 8973f83b20..35dba16cfe 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -174,7 +174,7 @@ typedef void (*virLogCloseFunc) (void *data); =20 typedef enum { VIR_LOG_STACK_TRACE =3D (1 << 0), -} virLogFlags; +} virLogFilterFlags; =20 int virLogGetNbFilters(void); int virLogGetNbOutputs(void); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 23:56:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524243431969180.22929562630213; Fri, 20 Apr 2018 09:57:11 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42F2F3182F42; Fri, 20 Apr 2018 16:57:10 +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 01A505BD65; Fri, 20 Apr 2018 16:57:10 +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 96D934CAA4; Fri, 20 Apr 2018 16:57:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3KGujbr019464 for ; Fri, 20 Apr 2018 12:56:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA53F11701C3; Fri, 20 Apr 2018 16:56:45 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 575AF11701C6; Fri, 20 Apr 2018 16:56:45 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 20 Apr 2018 17:56:38 +0100 Message-Id: <20180420165639.8386-4-berrange@redhat.com> In-Reply-To: <20180420165639.8386-1-berrange@redhat.com> References: <20180420165639.8386-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 3/4] log: support logging using shell wildcard syntax 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 20 Apr 2018 16:57:10 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Rather than specialcasing handling of the '*' character, use fnmatch() to get normal shell wildcard syntax, as described in 'man glob(7)'. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/util/virlog.c | 17 +++++++++++++++-- src/util/virlog.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/util/virlog.c b/src/util/virlog.c index 5262d613f6..1db10fcc71 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -40,6 +40,7 @@ #if HAVE_SYS_UN_H # include #endif +#include =20 #include "virerror.h" #include "virlog.h" @@ -508,7 +509,9 @@ virLogSourceUpdate(virLogSourcePtr source) size_t i; =20 for (i =3D 0; i < virLogNbFilters; i++) { - if (strstr(source->name, virLogFilters[i]->match)) { + if ((virLogFilters[i]->flags & VIR_LOG_GLOB) ? + (fnmatch(virLogFilters[i]->match, source->name, 0) =3D=3D = 0) : + (strstr(source->name, virLogFilters[i]->match) !=3D NULL))= { priority =3D virLogFilters[i]->priority; flags =3D virLogFilters[i]->flags; break; @@ -1409,7 +1412,7 @@ virLogFilterNew(const char *match, virLogFilterPtr ret =3D NULL; char *mdup =3D NULL; =20 - virCheckFlags(VIR_LOG_STACK_TRACE, NULL); + virCheckFlags(VIR_LOG_STACK_TRACE | VIR_LOG_GLOB, NULL); =20 if (priority < VIR_LOG_DEBUG || priority > VIR_LOG_ERROR) { virReportError(VIR_ERR_INVALID_ARG, _("Invalid log priority %d"), @@ -1718,6 +1721,16 @@ virLogParseFilter(const char *src) goto cleanup; } =20 + /* Only turn on fnmatch usage if we see special glob + * characters, so we use more efficient strstr() + * by default + */ + if (strchr(match, '*') || + strchr(match, '?') || + strchr(match, '[')) { + flags |=3D VIR_LOG_GLOB; + } + if (!(ret =3D virLogFilterNew(match, prio, flags))) goto cleanup; =20 diff --git a/src/util/virlog.h b/src/util/virlog.h index 35dba16cfe..95c405bac0 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -174,6 +174,7 @@ typedef void (*virLogCloseFunc) (void *data); =20 typedef enum { VIR_LOG_STACK_TRACE =3D (1 << 0), + VIR_LOG_GLOB =3D (1 << 1), } virLogFilterFlags; =20 int virLogGetNbFilters(void); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun Apr 28 23:56:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524243412606915.2714564440503; Fri, 20 Apr 2018 09:56:52 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id CE40430015C6; Fri, 20 Apr 2018 16:56:50 +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 9FA4D6012A; Fri, 20 Apr 2018 16:56:50 +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 F0EEE18033EB; Fri, 20 Apr 2018 16:56:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3KGukik019469 for ; Fri, 20 Apr 2018 12:56:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 99D8C11701C5; Fri, 20 Apr 2018 16:56:46 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C8F511701C6; Fri, 20 Apr 2018 16:56:46 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Fri, 20 Apr 2018 17:56:39 +0100 Message-Id: <20180420165639.8386-5-berrange@redhat.com> In-Reply-To: <20180420165639.8386-1-berrange@redhat.com> References: <20180420165639.8386-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 4/4] log: update docs for daemons to improve user understanding 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: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 20 Apr 2018 16:56:51 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Strongly recommend against use of the log_levels setting since it creates overly verbose logs and has a serious performance impact. Describe the log filter syntax better and mention use of shell glob syntax. Also provide more realistic example of good settings to use. The libvirtd example is biased towards QEMU, but when the drivers split off each daemon can get its own more appropriate example. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/locking/test_virtlockd.aug.in | 2 +- src/locking/virtlockd.conf | 70 +++++++++++++++++++++++++++--------= -- src/logging/test_virtlogd.aug.in | 2 +- src/logging/virtlogd.conf | 73 ++++++++++++++++++++++++++++-------= ---- src/remote/libvirtd.conf | 70 +++++++++++++++++++++++------------= -- src/remote/test_libvirtd.aug.in | 2 +- 6 files changed, 150 insertions(+), 69 deletions(-) diff --git a/src/locking/test_virtlockd.aug.in b/src/locking/test_virtlockd= .aug.in index ad75286be6..f2f6979ef5 100644 --- a/src/locking/test_virtlockd.aug.in +++ b/src/locking/test_virtlockd.aug.in @@ -3,7 +3,7 @@ module Test_virtlockd =3D =20 test Virtlockd.lns get conf =3D { "log_level" =3D "3" } - { "log_filters" =3D "3:remote 4:event" } + { "log_filters" =3D "1:locking 4:object 4:json 4:event 1:util" } { "log_outputs" =3D "3:syslog:virtlockd" } { "max_clients" =3D "1024" } { "admin_max_clients" =3D "5" } diff --git a/src/locking/virtlockd.conf b/src/locking/virtlockd.conf index 1a2b27d0b9..29cefbd74a 100644 --- a/src/locking/virtlockd.conf +++ b/src/locking/virtlockd.conf @@ -8,47 +8,79 @@ =20 # Logging level: 4 errors, 3 warnings, 2 information, 1 debug # basically 1 will log everything possible +# +# WARNING: USE OF THIS IS STRONGLY DISCOURAGED. +# +# WARNING: It outputs too much information to practically read. +# WARNING: The "log_filters" setting is recommended instead. +# +# WARNING: Journald may employ rate limiting of the messages logged +# WARNING: and thus lock up the libvirt daemon. To use the debug +# WARNING: level with journald you have to specify it explicitly in +# WARNING: 'log_outputs', otherwise only information level messages +# WARNING: will be logged. +# +# WARNING: USE OF THIS IS STRONGLY DISCOURAGED. #log_level =3D 3 =20 # Logging filters: # A filter allows to select a different logging level for a given category -# of logs -# The format for a filter is one of: -# x:name -# x:+name -# where name is a string which is matched against source file name, -# e.g., "remote", "qemu", or "util/json", the optional "+" prefix -# tells libvirt to log stack trace for each message matching name, -# and x is the minimal level where matching messages should be logged: +# of logs. The format for a filter is one of: +# +# level:match +# level:+match +# +# where 'match' is a string which is matched against the category +# given in the VIR_LOG_INIT() at the top of each libvirt source +# file, e.g., "remote", "qemu", or "util.json". The 'match' in the +# filter matches using shell wildcard syntax (see 'man glob(7)'). +# The 'match' is always treated a substring match. IOW a match +# string 'foo' is equivalent to '*foo*'. +# +# If 'match' contains the optional "+" prefix, it tells libvirt +# to log stack trace for each message matching name. +# +# 'level' is the minimal level where matching messages should +# be logged: +# # 1: DEBUG # 2: INFO # 3: WARNING # 4: ERROR # -# Multiple filter can be defined in a single @filters, they just need to be -# separated by spaces. +# Multiple filters can be defined in a single @filters, they just need to = be +# separated by spaces. Note that libvirt performs "first" match, i.e. if +# there are concurrent filters, the first one that matches will be applied, +# given the order in log_filters. +# +# For the virtlockd daemon, a typical need is to capture information +# from the locking code and some of the utility code. Some utility +# code is very verbose and is generally not desired. Taking the QEMU +# hypervisor as an example, a suitable filter string for debugging +# might be to turn off object, json & event logging, but enable the +# rest of the util code: # -# e.g. to only get warning or errors from the remote layer and only errors -# from the event layer: -#log_filters=3D"3:remote 4:event" +#log_filters=3D"1:locking 4:object 4:json 4:event 1:util" =20 # Logging outputs: # An output is one of the places to save logging information # The format for an output can be: -# x:stderr +# level:stderr # output goes to stderr -# x:syslog:name +# level:syslog:name # use syslog for the output and use the given name as the ident -# x:file:file_path +# level:file:file_path # output to a file, with the given filepath -# In all case the x prefix is the minimal level, acting as a filter +# level:journald +# output to journald logging system +# In all cases 'level' is the minimal priority, acting as a filter # 1: DEBUG # 2: INFO # 3: WARNING # 4: ERROR # -# Multiple output can be defined, they just need to be separated by spaces. -# e.g. to log all warnings and errors to syslog under the virtlockd ident: +# Multiple outputs can be defined, they just need to be separated by space= s. +# e.g. to log all warnings and errors to syslog under the libvirtd ident: #log_outputs=3D"3:syslog:virtlockd" # =20 diff --git a/src/logging/test_virtlogd.aug.in b/src/logging/test_virtlogd.a= ug.in index 744f3246af..a29e7e3730 100644 --- a/src/logging/test_virtlogd.aug.in +++ b/src/logging/test_virtlogd.aug.in @@ -3,7 +3,7 @@ module Test_virtlogd =3D =20 test Virtlogd.lns get conf =3D { "log_level" =3D "3" } - { "log_filters" =3D "3:remote 4:event" } + { "log_filters" =3D "1:logging 4:object 4:json 4:event 1:util" } { "log_outputs" =3D "3:syslog:virtlogd" } { "max_clients" =3D "1024" } { "admin_max_clients" =3D "5" } diff --git a/src/logging/virtlogd.conf b/src/logging/virtlogd.conf index c22b7737ef..f2078a730c 100644 --- a/src/logging/virtlogd.conf +++ b/src/logging/virtlogd.conf @@ -8,49 +8,80 @@ =20 # Logging level: 4 errors, 3 warnings, 2 information, 1 debug # basically 1 will log everything possible +# +# WARNING: USE OF THIS IS STRONGLY DISCOURAGED. +# +# WARNING: It outputs too much information to practically read. +# WARNING: The "log_filters" setting is recommended instead. +# +# WARNING: Journald may employ rate limiting of the messages logged +# WARNING: and thus lock up the libvirt daemon. To use the debug +# WARNING: level with journald you have to specify it explicitly in +# WARNING: 'log_outputs', otherwise only information level messages +# WARNING: will be logged. +# +# WARNING: USE OF THIS IS STRONGLY DISCOURAGED. #log_level =3D 3 =20 # Logging filters: # A filter allows to select a different logging level for a given category -# of logs -# The format for a filter is one of: -# x:name -# x:+name -# where name is a string which is matched against source file name, -# e.g., "remote", "qemu", or "util/json", the optional "+" prefix -# tells libvirt to log stack trace for each message matching name, -# and x is the minimal level where matching messages should be logged: +# of logs. The format for a filter is one of: +# +# level:match +# level:+match +# +# where 'match' is a string which is matched against the category +# given in the VIR_LOG_INIT() at the top of each libvirt source +# file, e.g., "remote", "qemu", or "util.json". The 'match' in the +# filter matches using shell wildcard syntax (see 'man glob(7)'). +# The 'match' is always treated a substring match. IOW a match +# string 'foo' is equivalent to '*foo*'. +# +# If 'match' contains the optional "+" prefix, it tells libvirt +# to log stack trace for each message matching name. +# +# 'level' is the minimal level where matching messages should +# be logged: +# # 1: DEBUG # 2: INFO # 3: WARNING # 4: ERROR # -# Multiple filter can be defined in a single @filters, they just need to be -# separated by spaces. +# Multiple filters can be defined in a single @filters, they just need to = be +# separated by spaces. Note that libvirt performs "first" match, i.e. if +# there are concurrent filters, the first one that matches will be applied, +# given the order in log_filters. +# +# +# For the virtlockd daemon, a typical need is to capture information +# from the locking code and some of the utility code. Some utility +# code is very verbose and is generally not desired. Taking the QEMU +# hypervisor as an example, a suitable filter string for debugging +# might be to turn off object, json & event logging, but enable the +# rest of the util code: # -# e.g. to only get warning or errors from the remote layer and only errors -# from the event layer: -#log_filters=3D"3:remote 4:event" +#log_filters=3D"1:logging 4:object 4:json 4:event 1:util" =20 # Logging outputs: # An output is one of the places to save logging information # The format for an output can be: -# x:stderr +# level:stderr # output goes to stderr -# x:syslog:name +# level:syslog:name # use syslog for the output and use the given name as the ident -# x:file:file_path +# level:file:file_path # output to a file, with the given filepath -# x:journald -# ouput to the systemd journal -# In all case the x prefix is the minimal level, acting as a filter +# level:journald +# output to journald logging system +# In all cases 'level' is the minimal priority, acting as a filter # 1: DEBUG # 2: INFO # 3: WARNING # 4: ERROR # -# Multiple output can be defined, they just need to be separated by spaces. -# e.g. to log all warnings and errors to syslog under the virtlogd ident: +# Multiple outputs can be defined, they just need to be separated by space= s. +# e.g. to log all warnings and errors to syslog under the libvirtd ident: #log_outputs=3D"3:syslog:virtlogd" # =20 diff --git a/src/remote/libvirtd.conf b/src/remote/libvirtd.conf index 9c0080dc06..63b8fdd38d 100644 --- a/src/remote/libvirtd.conf +++ b/src/remote/libvirtd.conf @@ -338,28 +338,41 @@ =20 # Logging level: 4 errors, 3 warnings, 2 information, 1 debug # basically 1 will log everything possible -# Note: Journald may employ rate limiting of the messages logged -# and thus lock up the libvirt daemon. To use the debug level with -# journald you have to specify it explicitly in 'log_outputs', otherwise -# only information level messages will be logged. +# +# WARNING: USE OF THIS IS STRONGLY DISCOURAGED. +# +# WARNING: It outputs too much information to practically read. +# WARNING: The "log_filters" setting is recommended instead. +# +# WARNING: Journald may employ rate limiting of the messages logged +# WARNING: and thus lock up the libvirt daemon. To use the debug +# WARNING: level with journald you have to specify it explicitly in +# WARNING: 'log_outputs', otherwise only information level messages +# WARNING: will be logged. +# +# WARNING: USE OF THIS IS STRONGLY DISCOURAGED. #log_level =3D 3 =20 # Logging filters: # A filter allows to select a different logging level for a given category -# of logs -# The format for a filter is one of: -# x:name -# x:+name - -# where name is a string which is matched against the category -# given in the VIR_LOG_INIT() at the top of each libvirt source -# file, e.g., "remote", "qemu", or "util.json" (the name in the -# filter can be a substring of the full category name, in order -# to match multiple similar categories), the optional "+" prefix -# tells libvirt to log stack trace for each message matching -# name, and x is the minimal level where matching messages should -# be logged: - +# of logs. The format for a filter is one of: +# +# level:match +# level:+match +# +# where 'match' is a string which is matched against the category +# given in the VIR_LOG_INIT() at the top of each libvirt source +# file, e.g., "remote", "qemu", or "util.json". The 'match' in the +# filter matches using shell wildcard syntax (see 'man glob(7)'). +# The 'match' is always treated a substring match. IOW a match +# string 'foo' is equivalent to '*foo*'. +# +# If 'match' contains the optional "+" prefix, it tells libvirt +# to log stack trace for each message matching name. +# +# 'level' is the minimal level where matching messages should +# be logged: +# # 1: DEBUG # 2: INFO # 3: WARNING @@ -370,22 +383,27 @@ # there are concurrent filters, the first one that matches will be applied, # given the order in log_filters. # -# e.g. to only get warning or errors from the remote layer and only errors -# from the event layer: -#log_filters=3D"3:remote 4:event" +# A typical need is to capture information from a hypervisor driver, +# public API entrypoints and some of the utility code. Some utility +# code is very verbose and is generally not desired. Taking the QEMU +# hypervisor as an example, a suitable filter string for debugging +# might be to turn off object, json & event logging, but enable the +# rest of the util code: +# +#log_filters=3D"1:qemu 1:libvirt 4:object 4:json 4:event 1:util" =20 # Logging outputs: # An output is one of the places to save logging information # The format for an output can be: -# x:stderr +# level:stderr # output goes to stderr -# x:syslog:name +# level:syslog:name # use syslog for the output and use the given name as the ident -# x:file:file_path +# level:file:file_path # output to a file, with the given filepath -# x:journald +# level:journald # output to journald logging system -# In all case the x prefix is the minimal level, acting as a filter +# In all cases 'level' is the minimal priority, acting as a filter # 1: DEBUG # 2: INFO # 3: WARNING diff --git a/src/remote/test_libvirtd.aug.in b/src/remote/test_libvirtd.aug= .in index 2bd7ec1bd6..527e3d7d0d 100644 --- a/src/remote/test_libvirtd.aug.in +++ b/src/remote/test_libvirtd.aug.in @@ -49,7 +49,7 @@ module Test_libvirtd =3D { "admin_max_queued_clients" =3D "5" } { "admin_max_client_requests" =3D "5" } { "log_level" =3D "3" } - { "log_filters" =3D "3:remote 4:event" } + { "log_filters" =3D "1:qemu 1:libvirt 4:object 4:json 4:event 1:ut= il" } { "log_outputs" =3D "3:syslog:libvirtd" } { "audit_level" =3D "2" } { "audit_logging" =3D "1" } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list