From nobody Mon May 13 09:20:03 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1709189707905668.0767035613069; Wed, 28 Feb 2024 22:55:07 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id D2DC01AAC; Thu, 29 Feb 2024 01:54:59 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 004291A49; Thu, 29 Feb 2024 01:53:38 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 77D6D1A49; Thu, 29 Feb 2024 01:53:34 -0500 (EST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id BD0021987 for ; Thu, 29 Feb 2024 01:53:31 -0500 (EST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41T1xxZ1004267 for ; Thu, 29 Feb 2024 06:47:01 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf90vchk2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:00 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41T5VZCs001763 for ; Thu, 29 Feb 2024 06:46:59 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wf6wa2trp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:46:59 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) by CH2PR10MB4150.namprd10.prod.outlook.com (2603:10b6:610:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 06:46:57 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc]) by SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc%7]) with mapi id 15.20.7316.039; Thu, 29 Feb 2024 06:46:57 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qo/tG0aLMxQbt3VAsB7d0YkhPK3K8nqOQvou/GGKKYzJj/pueIGrokjAyKn9rp4zHdHifsMV+M5LZ3hEMkphEOhcWGMcMrIhg9walY80f0UKPOABsSbsPpi/Sr/iLcD00pwJTpxaYCYJPMrqQckawUPbEcmi8i6Rtjrd5P1gb3KzTciVEFd7L0XoIL4AOSib6S1iBrxXjx2nEZgvs3JNvEWJAKITCgu+8rA44WkM+x9FQhxmUkA/GYbpppasftM9f7CtEO9AuAupgZecuzRjmF/DlkqMkwO/LfOc36Koo+cJiyhowBrR+03U/P0doeVbd0zKHq0j0SKTbeaBKEI2UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rfpiM8bgMj9zOtajmfgfzxcPE/Z/1/TBrUAmTetwUIk=; b=MJ7lgtDrm6htwoPwbkUO3lKHKHLZyOsWWFsM6j53QakIc/5YADTBXaihGpTZS529iHlJP9KccRJUi9OJhg0UzUa9oRvLNXVm4Mq4XdPZbCw/vhpmKNQCMA40DVXZA7c+4Ij635Odr7m6gizq33MMVewYHQ0auWX/RtGQupuWQmH7rELJP+I6+dHhOKcW/0utF6mJK031fJb1sun/PPIHEU8Pi1L/58tmvjX0tTzCA03srESymSbhxS+mpB3JWQcKDakKFJ2FTDJGG86zZ12fprME3iuglFfOlgRCQVOAQDHBX54N5SoejOjYoVuoI0TYsGMa35b0UaqoFOLDPzbDOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none From: Shaleen Bathla To: devel@lists.libvirt.org Subject: [libvirt] [PATCH 1/4] logging: virtlogd: Add option to append timestamp to domain logs Date: Thu, 29 Feb 2024 12:16:36 +0530 Message-Id: <20240229064639.1731653-2-shaleen.bathla@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240229064639.1731653-1-shaleen.bathla@oracle.com> References: <20240229064639.1731653-1-shaleen.bathla@oracle.com> X-ClientProxiedBy: BY5PR17CA0041.namprd17.prod.outlook.com (2603:10b6:a03:167::18) To SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5768:EE_|CH2PR10MB4150:EE_ X-MS-Office365-Filtering-Correlation-Id: f596e8a8-e030-41f5-43ef-08dc38f23979 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eolqVuLRW8CkHCEeukmPTWM4ubQnbsClqGbuO+TEMsSl2J1yUBZ08/v3UWE3tnuzHcdnboUGArQNFFI/O0afRRTAwNkX5SmbOh1+fBai/T02X7dCgl49ReA5nsCdkWZTbjumNWGPrj0rsslS78kG3Zn/ujjx1Id0eGTMDYGXLL1u9ga0QpsjOB6MufUlzJOYjhl7Ku9ue25Z5xjD/OZopcRCz3nhqt5dTe3Ku5D5snBvtE7Gj4qO/dPVKlcCkEDysN26C9vFRU5j1injzTZ7cRbWhlpldXTcKBe4Bn03B1vehJCj+YWDHZn83XXf2NKkDrGqZsyM09bRPv0tt9IBFE65b+9rcvTwP3jVIekgSFkMMQUpVMHmtZPPHfn/zdV8ALTtcPZYesOMGt3E1UlZuxcqyxV1z6DhElko5N9fqeHlJx+AeAN/x2U+kp9woeDBCsCwJqhhImEON8xx2LjOfZIPUsfLhrEFe7dbf8uNy42sK6IJ3yNGf3GSn1wU4gBzXgz33uuZKYN5k/sZ5BFf1bLpwjkWdLl4tqkn9Y1KvUDgMpqgZdre7iqkSnuy2TQymPuhDbOhaWFZj4lr/j6cl0dJDdGvZyZ0Q39+HsPzmHxanWW1ANj9GXMTd2U/VJ4BkxCGxZbKhpEAuHGo3jYYeQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5768.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YUJMNV4VPVvzDSjAh8ScmELJouh66iUe1CZjp05WDwdifv79Sxbj8PQGKDtD?= =?us-ascii?Q?gM9WqW/wcurSH4s8j75aXoNuPawIhc+ZCQvw/Zjlx/zD+Jx+oBhhTDznuVyS?= =?us-ascii?Q?mR+QnwMX/qjq9HHBQofnZpMhYmAHh7Vz0lVSfW+NLOW0lVlQrUqeDR8QIF6s?= =?us-ascii?Q?GKPOJKwmXd9MGUbh/Vb0nEczyLe+ut7l9tevGtzPNamg+o49iEe+PY18yaL2?= =?us-ascii?Q?YsQrknP8QibUW/CHSqU+XEzI3kP4pUdjIbX89N2Z11q9aIswxbdruX/cjanW?= =?us-ascii?Q?DZTqAMfraZbLiLzt9dPqg3xiSYavWw6hEdR+w2JyXdQPrafCWwEGFJEZDUL7?= =?us-ascii?Q?WHg1LF0y1+iOJw5gqgihJhN1MmZyDj2G5L7frtX1vifNIFy2XqVE1GRE80xz?= =?us-ascii?Q?/KGptPvvc01CTtpom93K5fhuRzktLvY2Pgxe65c4QRMVUbYmqZIGHJuGw/Vh?= =?us-ascii?Q?kNKB4I1I7A6ZDfMNkI1+nQpWihs+mXEH/LEN6Uj/aL+yyiHA4LohAVan4xhU?= =?us-ascii?Q?JgBWEjokgN5XfiBOtOSwzuC3LQF/gt4twx4e4Agaj62r705C0U4KoxqPC7/q?= =?us-ascii?Q?11QGxkonOD9ZCuSfZ/mF7YnIem6iDiYPG2Y1TpPnNy99grUUgsJDzb/4vxBm?= =?us-ascii?Q?4Emsnwyu7wsYvWfmQMA2FA/qVzHGpW5POwtMVBRzVxl2oRMrBbP4Yi4gqKPa?= =?us-ascii?Q?Em18+4NnE6fuvE/RuwCAiqaRjE/J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A=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: DizqaGt3zoyoXMFjw79KOfzUmSPVQf14PgOyY77iBCaRVO9i0DzAx84ved0l97Jaft6xeoauhr2puAh4loOj5ercfFam+ayNAJhW1A6NYtHrbwI2qkzEewqLHNGCPk7dTETj2MvSqC3Y00dhsImAFVls++3Zx5Z41CrFbvPCTPdrsjIWRoInfAlN7P8qZT92aGUjPET50X/bqRmoBFcrp3KR/yASiHgSkgzPnf6f8GoWYCvpUhFc598KyqbOgRiAiJy3NIrzxat0JQGP0Sjno0u+BI2la2sipUQHUMWxioMQKHvZ1G1yqpVU6UvXwcIbE8uuN7KhKWFoJJFgVh1LFbPc0ZQtDA8+wQg12sW2qlDsCxmwKIncFAosTL+QGV+s4mKRaXYP3nr19hHFZI6Ob0qqYh57CHC2hehJoCtPyOkZvics4pFfDscHHfv1Sd4Je3t7K/sB+vOc7S9A01GXUcoHB7d0JuPIlpxkOvIVqCgpkrFLT9Fni1L0zvb9fqbw+OFaw2DbODN69NU4gMWqxLTaQdIQjJPHpY0pIRL0Af4pajRaFAYJQsTpDu5mRS+44JgieeqznfwJvV2AMLNnDdkjEB58UP+c9TTz08KSxBE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f596e8a8-e030-41f5-43ef-08dc38f23979 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5768.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 06:46:57.8045 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0tlj3F0TdoLMsnSCSPGae1DTPlO8jMI+92SIqUf38KswvDkSA9M0AXsRNVguxhTWMHcO1O7vgi9zivzw7sZSuYscGqddzEenhCaRDUU884Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4150 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 adultscore=0 mlxscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402290051 X-Proofpoint-GUID: WCwRPt8vlwQQt5iikDI3vOigYFDmnpiM X-Proofpoint-ORIG-GUID: WCwRPt8vlwQQt5iikDI3vOigYFDmnpiM Message-ID-Hash: APGBA7KWOCEA6PFEPI73GWSRYHFF6NO5 X-Message-ID-Hash: APGBA7KWOCEA6PFEPI73GWSRYHFF6NO5 X-MailFrom: shaleen.bathla@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709189709323100001 In virtlogd.conf, introduce a new timestamp option. When set to 1, timestamp is appended after \n in serial console logs. Signed-off-by: Shaleen Bathla --- src/logging/log_daemon_config.c | 3 +++ src/logging/log_daemon_config.h | 1 + src/logging/test_virtlogd.aug.in | 1 + src/logging/virtlogd.aug | 1 + src/logging/virtlogd.conf | 4 ++++ 5 files changed, 10 insertions(+) diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_confi= g.c index 248bd927d3f0..278e4c0a7832 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -62,6 +62,7 @@ virLogDaemonConfigNew(bool privileged G_GNUC_UNUSED) data->max_size =3D 1024 * 1024 * 2; data->max_backups =3D 3; data->max_age_days =3D 0; + data->timestamp =3D 0; =20 return data; } @@ -101,6 +102,8 @@ virLogDaemonConfigLoadOptions(virLogDaemonConfig *data, return -1; if (virConfGetValueString(conf, "log_root", &data->log_root) < 0) return -1; + if (virConfGetValueBool(conf, "timestamp", &data->timestamp) < 0) + return -1; if (!data->log_root) data->log_root =3D g_strdup(DEFAULT_LOG_ROOT); =20 diff --git a/src/logging/log_daemon_config.h b/src/logging/log_daemon_confi= g.h index 43922feedf6e..8fe3ac460cb8 100644 --- a/src/logging/log_daemon_config.h +++ b/src/logging/log_daemon_config.h @@ -36,6 +36,7 @@ struct _virLogDaemonConfig { =20 char *log_root; size_t max_age_days; + bool timestamp; }; =20 =20 diff --git a/src/logging/test_virtlogd.aug.in b/src/logging/test_virtlogd.a= ug.in index 8dfad3950608..dfae4fff15fd 100644 --- a/src/logging/test_virtlogd.aug.in +++ b/src/logging/test_virtlogd.aug.in @@ -11,3 +11,4 @@ module Test_virtlogd =3D { "max_backups" =3D "3" } { "max_age_days" =3D "0" } { "log_root" =3D "/var/log/libvirt" } + { "timestamp" =3D "0" } diff --git a/src/logging/virtlogd.aug b/src/logging/virtlogd.aug index bdf61dea6eb5..a1e5c09bbb04 100644 --- a/src/logging/virtlogd.aug +++ b/src/logging/virtlogd.aug @@ -33,6 +33,7 @@ module Virtlogd =3D | int_entry "max_backups" | int_entry "max_age_days" | str_entry "log_root" + | bool_entry "timestamp" =20 (* Each entry in the config is one of the following three ... *) let entry =3D logging_entry diff --git a/src/logging/virtlogd.conf b/src/logging/virtlogd.conf index 5214e96121a1..2c45f3da2e3d 100644 --- a/src/logging/virtlogd.conf +++ b/src/logging/virtlogd.conf @@ -115,3 +115,7 @@ # WARNING: all files under this location potentially can be GC-ed. See the # warning for max_age_days. #log_root =3D "/var/log/libvirt" + +# Append timestamp to serial console logs after every '\n' character +# Defaults to 0 i.e. turned off +#timestamp =3D 0 --=20 2.39.3 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Mon May 13 09:20:03 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1709192511490548.0582508708342; Wed, 28 Feb 2024 23:41:51 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 253091B6F; Thu, 29 Feb 2024 02:41:50 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id D9A681A18; Thu, 29 Feb 2024 02:40:27 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 2232E1A22; Thu, 29 Feb 2024 02:40:24 -0500 (EST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4B0491A18 for ; Thu, 29 Feb 2024 02:40:21 -0500 (EST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41T1xrmG017944 for ; Thu, 29 Feb 2024 06:47:05 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf722mju9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:05 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41T5nBPV022403 for ; Thu, 29 Feb 2024 06:47:04 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3wf6wadft2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:04 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) by CH2PR10MB4150.namprd10.prod.outlook.com (2603:10b6:610:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 06:47:02 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc]) by SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc%7]) with mapi id 15.20.7316.039; Thu, 29 Feb 2024 06:47:02 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gtZnPrwn0PhfyRmzBL5T10AYIpU/yC5MprzBWD2Zb5jzELqpWt/W/L5tVcnHbqmn+0b8CQdurAOkDPdFXBtHafnq3/9XWZsrBlVa7J7HBM5q3kx/+nEggT3tSNWK6RIxfuQhud/I7RFXvp2VoDPT1SRXYR1bMR7m8Aqt19euAKaSEZSLqBZIOe7oizrkWmLiDUXjFNEgcrSBXDlQ9sKNJ//TPj8TOu8w/oc4xWheCgKrOm9AHjkKYJy8BsIWjlxUCLVWCOcQZXGv19v4wJElWSWQr+sd33JOPp3yw2tcl50H9b0TfruEOdvMSsX3GiZmbOUuhhWB3oOeoKfzWTX7gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=62Xjy8DFqxqQuKbAVmyLmQwA8gHvKR4553FZNLa2Xw4=; b=QOaSCq31Y3IVpNwN0EwEEl5pktFEOs3FVzOAGPYQZ5LiV7/umxoEF4HS5X4/5LnAGKjaMxgK3vCe711yNUIZAnlv4U4+dKfaeHj7y4xz/RhkoAYOxPRFVeHRCrxJxn+35o2HykjRBbydOnuU4hthsZQsGG3fVXYCQsmAGtTAcvXNlzR3kSBIjflEY99qRX8ybIQiedtUpe/TimmHYa/NeWE28P9pQVogAVTP7OtpO3yRkhP63peeD4RnPSK3xo++P0fJCI0Bq+2LsUQk4UDbLY1zJ3OMa0jEJ/l2B6riZ/4p/8fVRxEGySKA+2GVVZb7EXqVb0e1MKFjW4NWUBeCVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none From: Shaleen Bathla To: devel@lists.libvirt.org Subject: [libvirt] [PATCH 2/4] util: virrotatingfile: Introduce virRotatingFileWriterAppendTimestamp Date: Thu, 29 Feb 2024 12:16:37 +0530 Message-Id: <20240229064639.1731653-3-shaleen.bathla@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240229064639.1731653-1-shaleen.bathla@oracle.com> References: <20240229064639.1731653-1-shaleen.bathla@oracle.com> X-ClientProxiedBy: SJ0PR03CA0350.namprd03.prod.outlook.com (2603:10b6:a03:39c::25) To SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5768:EE_|CH2PR10MB4150:EE_ X-MS-Office365-Filtering-Correlation-Id: f94e60ff-aa0a-4fd8-d13c-08dc38f23c35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBuD5VcVh0WEBY3qwCNUXo+5M/wT7+8mBgxMOsmGAPVhntAjjKGn7zcwUgo3ag7aYzT02X5Ra2jN0E0iF3FqFxUV6mm4hoqFZwOgZDRwqHwGRy21lqDqi1iZ879zcVFWxY/YKKCmhFe44leYv7D0xyYoLgl/vSSC59pgAWXGmoHbndTtClV6YCmbadZCO14b4Nv5glm1mVri0HqUAyVhHuz1SbqNxbrf5SYoT3X87lT21JRZPKfBK8gaySeArMvlcgL6PAiVzpyEXn9xP85RLCSj1ZgKnfZamT4BLQCpJmydgcETgkm99U9BiyFjXcXl2vNnI5pzCEpiyrym2A2+mldGtCgUtStZGE+yWH7I0IFOmzc9+zNuZjKY1gt4tYBl3AdfowIUwYYVUxPFj3hQNRWD/O0LzkqCfb0LESQor6jtNQa1/IT3yJdK8MNnmMf7fbgphLdnMwPDPBYavoGmf12nGEDFCVwQcbxLpNOnZMNwJH8Wiw9fpqQonbQaPW07kDytYyaLHdN7tHgQm2Z7EoGIDjsV+eDXLw7yohivlMNotjQWu3t+MXrAR2sOdRpvqJUGiDS6CmFrvIR4lrAsRVqkrU+ZUUWneuLvIXukPo86qL3sPAwe3hRIG4BHmyNCEnZqR8wkaITPwXuisvzyVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5768.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4DJGYw9ygWZOjT5xv022r/dnyj0yM9M7iPyaQn9JfZMJwGanwforV+oQ3rrg?= =?us-ascii?Q?Awm7uO4oXViszXZO8syvWuCIPJw1Cg6B+Zwqm2KHbGDkWiN5zJusPYFTX3MV?= =?us-ascii?Q?wJwzhhpX0xGd6EZzKv5UgPps1G1pJnLywkeTne1KYsqYece3NsYRbS2+NBZx?= =?us-ascii?Q?pOYOd0xidpPUlnS45V7B0VvJ7rfR2gMIX2OuuHmtqeX8Gqj1Qfxbf1xEr592?= =?us-ascii?Q?YrO7/is6PagWy4GRQXYJUxgOEsMFIBU8onhM2jAgWZbR0+fXn6cl0GrN+uK2?= =?us-ascii?Q?TLDpYRA5Nt8rmx2A0Az8IfUqsJYOt7crf7HY2GYQhgRHHCBJH4Dm8xXRVvBa?= =?us-ascii?Q?u04DkHbtVw4j1XlUckWFzkLqKZvHaiBWKCRhsTezdaYsJNLQmngRbbnIrUU9?= =?us-ascii?Q?uVnue2VdlzsGxSFHX/1XxGOXgxacqEFlTwi4JXBdka3NUst499SImusXW+gG?= =?us-ascii?Q?08gGxyq8xZsENNJFC8AcQMC0mac4SKXLbh/PbWu/pepLEz4r0kHzrkY8RiTm?= =?us-ascii?Q?i9jTGXUkJBACyoDU04+RQ7ap/HTd7I3+tj9b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F+XsrLa7iWUpAAsPoC5EmM4UR9yzRZ16mYTs1w476eZPJVD5bXu?= =?us-ascii?Q?L76Va65U7GVmcjj0Ll5MjjdEAF+pSBneDSt6Z+lp1yvlVduyo2G5/hAVfQem?= =?us-ascii?Q?YyRN5C2JpWpjcayKjaUuhs2o62foJQ8V1E8LKVLKrVDP37Zxl5/HWibl4Lbw?= =?us-ascii?Q?mg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: zuki+fHA7CP4AKAu6u61lhwPDdba3lj6Sn7GIM0D9wXJ99USS3I6Iag4lY6+I7rY4VcdhDu4/+9HG2SazOPMTJtTfPuneWSeiA7ODfwNR7vdU9uchzZ05V4dwQLNE4+vJzdIzn/1Gz83+/rw1vLvtB8mGe+JXpeyKKT/zH84/ul15sdhJR1DkFd7koSjqaUwOaLffsDDsGGbZ77o9B26I75QA/qXTn3Sl+hHvyoqEmYXJ7d6lKuSyLCuaj3i5UvR5r/DR+fvJovN1TSK+eKiFVBFghDrZ9pckXnnda0fE4yYtegN5NzHkJugCgNU86M6EuxHE7NQbLXkCoWjqWr+9uZotUhTCIb+psKp3tKGYuUwLPZc38BXXGakolxS8F6qjXdIlklA87rVTr2KbGiqsDddcV38vPjV9PAQ8wxU6S499BbqC249/U7aL+rALVABIGNZuGTqYsU/Nvxz4OCPB5nzZ+35/7Z5ib7edIEHNGvkrZzT2pGrJQOJIel3zfEzoxPZQHlxIDOfEmFSBI9O1NDHAiVxf0NP+DPI1Dic5avMpoPPJPanm8oMh6ddWxSrhLzj1Gh2/mref6TvsYQpqNu9MbVCiR8qjOEeRKANkXc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f94e60ff-aa0a-4fd8-d13c-08dc38f23c35 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5768.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 06:47:02.4195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hOkzX3zk6+nNmSAcbUsBf+d8WdOnYaANIHhDHR6/G/dn7Z91N1W/ztjActiX1s4rKu5YyrxV6LiHt8UXGu9cW13C8kVyi+6JL2Z6Y9K/AA0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4150 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402290051 X-Proofpoint-ORIG-GUID: PxNysKv3wcwXKitVnRIuFlS3KWhXKUoS X-Proofpoint-GUID: PxNysKv3wcwXKitVnRIuFlS3KWhXKUoS Message-ID-Hash: BJL7XRDG6I2WDRIIGNT4L5PWCKJCB5GQ X-Message-ID-Hash: BJL7XRDG6I2WDRIIGNT4L5PWCKJCB5GQ X-MailFrom: shaleen.bathla@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709192512431100001 virRotatingFileWriterAppendTimestamp function appends timestamp to a file. Signed-off-by: Shaleen Bathla --- src/util/virrotatingfile.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c index b02a88c4b08d..2a44c9bf93e3 100644 --- a/src/util/virrotatingfile.c +++ b/src/util/virrotatingfile.c @@ -30,6 +30,7 @@ #include "virerror.h" #include "virfile.h" #include "virlog.h" +#include "virtime.h" =20 VIR_LOG_INIT("util.rotatingfile"); =20 @@ -406,6 +407,40 @@ virRotatingFileWriterRollover(virRotatingFileWriter *f= ile) } =20 =20 +/** + * virRotatingFileWriterAppendTimestamp: + * @file: the file context + * + * Append current timestamp with a trailing ' ' char to @file + * + * Returns 0 on success and -1 on error + */ +static ssize_t +virRotatingFileWriterAppendTimestamp(virRotatingFileWriter* file) +{ + char* timestamp =3D NULL; + size_t len =3D 0; + + if (!(timestamp =3D virTimeStringNow())) { + g_free(timestamp); + return -1; + } + + len =3D VIR_TIME_STRING_BUFLEN; + timestamp =3D g_realloc(timestamp, len+1); + timestamp[len-1] =3D ' '; + timestamp[len] =3D '\0'; + + if (virRotatingFileWriterAppend(file, timestamp, len) !=3D len) { + g_free(timestamp); + return -1; + } + + g_free(timestamp); + return 0; +} + + /** * virRotatingFileWriterAppend: * @file: the file context --=20 2.39.3 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Mon May 13 09:20:03 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1709192901511272.5398029491291; Wed, 28 Feb 2024 23:48:21 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 700A21B6D; Thu, 29 Feb 2024 02:48:20 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1C39B1A45; Thu, 29 Feb 2024 02:46:19 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7A5E41A40; Thu, 29 Feb 2024 02:46:15 -0500 (EST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 9BA131A22 for ; Thu, 29 Feb 2024 02:46:14 -0500 (EST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41T1x9te016399 for ; Thu, 29 Feb 2024 06:47:09 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf7ccmj1n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41T6cXbP019283 for ; Thu, 29 Feb 2024 06:47:07 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2101.outbound.protection.outlook.com [104.47.70.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3wgbdnvwqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:07 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) by CH2PR10MB4150.namprd10.prod.outlook.com (2603:10b6:610:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 06:47:06 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc]) by SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc%7]) with mapi id 15.20.7316.039; Thu, 29 Feb 2024 06:47:05 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y42D9QE6Kj8xf5PdXwdNEQlGHMnGM4+d8/X2B9Pw7BZwxu0Wz1Jz4+So5jZ3I0uKBEaFHzFdmbuiNClRGQgLTExW5TUSdp9dkYC1q6e95YmwSDi6qiRi2pWvlhy64pSx5hp99LBW0gVnnfUIfCDOG2bemmevOQBYc/ggC+Zw9y66eq1ZoUiV36gdt2Zp98KIOQJ9/sTzIiRXQd9U/XKyQHx/buZ45brXDsBZ7YfjWKoDzh6xW/4/Jyey9QmsRNQ/8TWgdosoyCiO3n7xRGGn950RjRKCUJ9NlNDUUhuOahVTMeVcQSaQOcHxz1OtmiWOz4ozNA+bzfWUlzOiMwJBVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3i0/9EuLFPMAsAv/p2bxLAoUfLD3afoiMGqbA9tNNJI=; b=Zro7tm9RlA9TYlgIsJvCI/HhuLrs0qOV4tIxKnOOhGsyvezltIxs85VNI/1uNykxkvzdlnpA+Fg+ILXVIHLQmQcMPBbRzvZSvvKh7hSVlmjTZ5DsKW0AZ0Xl94/mce23kDoafqWOdqSe5hYccsA30L4gCiR/BmUJGsKt4x4FaSB8WFnkfQrLG80C/94lhteR6PuTAdAqZa+2WB+42vLcyzLz8yks33A0TQLU/FNRomPN/yjezRo/gzWgsmmAhIQ+USwCefHCy3oBnxJmT4F5+Ura35gGsHvJ77neNcTJjYA+Bz3JdR16l6NHNwaypJbmGLJDbGh3pZaP3yRYLSQxlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none From: Shaleen Bathla To: devel@lists.libvirt.org Subject: [libvirt] [PATCH 3/4] util: virrotatingfile: virtlogd timestamp appending logic Date: Thu, 29 Feb 2024 12:16:38 +0530 Message-Id: <20240229064639.1731653-4-shaleen.bathla@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240229064639.1731653-1-shaleen.bathla@oracle.com> References: <20240229064639.1731653-1-shaleen.bathla@oracle.com> X-ClientProxiedBy: SJ0PR03CA0331.namprd03.prod.outlook.com (2603:10b6:a03:39c::6) To SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5768:EE_|CH2PR10MB4150:EE_ X-MS-Office365-Filtering-Correlation-Id: fa6763f9-4cae-4c94-249f-08dc38f23e45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t3b2A1gLcHla71M+8QtRe+vSY3K4PvqcyglJoifiRO9ZNoktk9v9iU+78wPcuaIXOUBQC8fCYRHIDmHxKzdGnHfp2mUGXXaHBQK5NQsnlbAv7Gj2WRKEUwKXJfwoK8bpQcqUHRS5g1e99bQMmJkQ0t354mP7kM85p37ediboLq5MDdoUanqEzetiGU9UdbcYpWdzbhZNNzWylgLp3mxZvvbHiqy7LqAQ+6u3WWtSEimSUZ+PevRTMLpdVj8e8RbUiOfaN/FPH1XJZtnMx48ofLhOsRXxxy69Z8XxfxApmRv6yB0lkC+h3U6XQiiCjAamz5lP/kM+4MDTGg1tImrir7aKFOT7u7SO0o6cQwvt0MxBS1BWb+c8EPJkC2F5jwB8c34sNW8OX3Lg0ZNKb3LzUK5/DOCvmTOnQuSj1zNyUalsTV7Qb5eUMWbAPUEMsA82TDME7h/XU1e2xSFokuQgl5OndRLFHJEKTlm0ybvFV4wf6T4fckTBfk++khqBNkzGtn/5MjZtF8rgfXPkYDoEh76xxjtAmXa8RXlAKezOIhNRE5Hhh9KJGY6VWZ8Jv9D081okW0TeT1EUVqoeYUjw4duUrNAabzdH+sHY/iyQualh+r45Ait+TZdS+gjucJaWwgYLAGrWEaYmvWncCIZLrA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5768.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?G/28ZiIyjeZOoG6LOO5o2LpvAeI6fx4H4aHRJxo7Z+7VmcW+vBOgFM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wrLU0viwWTH32I7WUlqvQqcxGDas+cy1MMnqNqHYXQAKU29PuEvr8NiZF0FUFrqvD0EVQ9x5OWXNmfPnQzSNYXNNXsCeG8OkTVfH2iDwhi+S3OyfCILjxROd0zn7tElkKWDWNVjGtXtrMPiJzhDPMTNPOtWN4PecBx26Nyn1HgEpbOr25TH1EqZfTQUvaDyCvYwrO/Erb6RgsWSj9YI2KwBP2MV2XuXlLMmuHdLvvq5Kp71G37brmXrLT9+XNknZA9adQIrWj1WXQfjKk57iUsIcVD8RD73G1EoWHEWsnpipsiNqHVaJHHCAPKiiYGZMSjM8wFNZxBCWwUIV+iTXKBSUqXM8otu/sIwZSXeBvzZBH2l1sFks3t646F6jV0/XYetZW/3uX4KVyCOE2BHP5JcOXl6pH2Q6nMJwWkmG4V3lCWVqyBuLbHgWe5aaLhfJGvuMt4kKq878Uca7u4KTeJs6MreA67xdCj5nH86uZUcs1zZYT4HR2erFWcU5bt4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa6763f9-4cae-4c94-249f-08dc38f23e45 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5768.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 06:47:05.8651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1cJjLPFEKi0pQ5Jx0tO+yZzRGkr3EysqD6iCmVGNxptg+UwkxRZkWaaTU1aiwVwxKS/0ukr1nuNexRgrA7UD9txLjia2w3062H0EsyLxAqs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4150 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 phishscore=0 mlxscore=0 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402290051 X-Proofpoint-ORIG-GUID: -pladK4Hpg2hfv-o7o70Jrnp90iCsfwh X-Proofpoint-GUID: -pladK4Hpg2hfv-o7o70Jrnp90iCsfwh Message-ID-Hash: EAHE4SUWCKBV7UHHJFRAESQCIM7CID7X X-Message-ID-Hash: EAHE4SUWCKBV7UHHJFRAESQCIM7CID7X X-MailFrom: shaleen.bathla@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709192903582100001 Make use of timestamp option in virtlogd config and append timestamp to domain event logs after every '\n' character. Signed-off-by: Shaleen Bathla --- src/logging/log_handler.c | 10 +++++++--- src/util/virrotatingfile.c | 36 ++++++++++++++++++++++++++++++++++-- src/util/virrotatingfile.h | 3 ++- 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c index 71517bbbe5ff..9be338d92ca1 100644 --- a/src/logging/log_handler.c +++ b/src/logging/log_handler.c @@ -116,6 +116,7 @@ virLogHandlerDomainLogFileEvent(int watch, virLogHandlerLogFile *logfile; char buf[1024]; ssize_t len; + bool timestamp =3D false; =20 virObjectLock(handler); logfile =3D virLogHandlerGetLogFileFromWatch(handler, watch); @@ -130,6 +131,9 @@ virLogHandlerDomainLogFileEvent(int watch, goto cleanup; } =20 + if (handler->config && handler->config->timestamp) + timestamp =3D true; + reread: len =3D read(fd, buf, sizeof(buf)); if (len < 0) { @@ -143,7 +147,7 @@ virLogHandlerDomainLogFileEvent(int watch, goto error; } =20 - if (virRotatingFileWriterAppend(logfile->file, buf, len) !=3D len) + if (virRotatingFileWriterAppend(logfile->file, buf, len, timestamp) != =3D len) goto error; =20 cleanup: @@ -440,7 +444,7 @@ virLogHandlerDomainLogFileDrain(virLogHandlerLogFile *f= ile) return; } =20 - if (virRotatingFileWriterAppend(file->file, buf, len) !=3D len) + if (virRotatingFileWriterAppend(file->file, buf, len, 0) !=3D len) return; } } @@ -568,7 +572,7 @@ virLogHandlerDomainAppendLogFile(virLogHandler *handler, writer =3D newwriter; } =20 - if (virRotatingFileWriterAppend(writer, message, strlen(message)) < 0) + if (virRotatingFileWriterAppend(writer, message, strlen(message), 0) <= 0) goto cleanup; =20 ret =3D 0; diff --git a/src/util/virrotatingfile.c b/src/util/virrotatingfile.c index 2a44c9bf93e3..5443e850721b 100644 --- a/src/util/virrotatingfile.c +++ b/src/util/virrotatingfile.c @@ -431,7 +431,7 @@ virRotatingFileWriterAppendTimestamp(virRotatingFileWri= ter* file) timestamp[len-1] =3D ' '; timestamp[len] =3D '\0'; =20 - if (virRotatingFileWriterAppend(file, timestamp, len) !=3D len) { + if (virRotatingFileWriterAppend(file, timestamp, len, 0) !=3D len) { g_free(timestamp); return -1; } @@ -446,6 +446,7 @@ virRotatingFileWriterAppendTimestamp(virRotatingFileWri= ter* file) * @file: the file context * @buf: the data buffer * @len: the number of bytes in @buf + * @timestamp: append timestamp config option * * Append the data in @buf to the file, performing rollover * of the files if their size would exceed the limit @@ -455,10 +456,12 @@ virRotatingFileWriterAppendTimestamp(virRotatingFileW= riter* file) ssize_t virRotatingFileWriterAppend(virRotatingFileWriter *file, const char *buf, - size_t len) + size_t len, + bool timestamp) { ssize_t ret =3D 0; size_t i; + while (len) { size_t towrite =3D len; bool forceRollover =3D false; @@ -488,6 +491,35 @@ virRotatingFileWriterAppend(virRotatingFileWriter *fil= e, } } =20 + if (timestamp && towrite) { + int last_nl =3D -1; + for (i =3D 0; i < towrite; i++) { + if (buf[i] =3D=3D '\n') { + if (safewrite(file->entry->fd, buf+last_nl+1, i-last_n= l) !=3D i-last_nl) { + virReportSystemError(errno, + _("Unable to write to fil= e %1$s"), + file->basepath); + return -1; + } + if (virRotatingFileWriterAppendTimestamp(file) !=3D 0)= { + virReportSystemError(errno, + _("Unable to write to fil= e %1$s"), + file->basepath); + return -1; + } + last_nl =3D i; + } + } + + last_nl++; + buf +=3D last_nl; + len -=3D last_nl; + ret +=3D last_nl; + file->entry->pos +=3D last_nl; + file->entry->len +=3D last_nl; + towrite -=3D last_nl; + } + if (towrite) { if (safewrite(file->entry->fd, buf, towrite) !=3D towrite) { virReportSystemError(errno, diff --git a/src/util/virrotatingfile.h b/src/util/virrotatingfile.h index 1ed8838e7df2..388774bc3913 100644 --- a/src/util/virrotatingfile.h +++ b/src/util/virrotatingfile.h @@ -43,7 +43,8 @@ off_t virRotatingFileWriterGetOffset(virRotatingFileWrite= r *file); =20 ssize_t virRotatingFileWriterAppend(virRotatingFileWriter *file, const char *buf, - size_t len); + size_t len, + bool timestamp); =20 int virRotatingFileReaderSeek(virRotatingFileReader *file, ino_t inode, --=20 2.39.3 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org From nobody Mon May 13 09:20:03 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1709189484581705.0378544398512; Wed, 28 Feb 2024 22:51:24 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 73DD51AFC; Thu, 29 Feb 2024 01:51:22 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id B7EB41A4C; Thu, 29 Feb 2024 01:49:30 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id CE9B61A4B; Thu, 29 Feb 2024 01:49:22 -0500 (EST) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 152DB1973 for ; Thu, 29 Feb 2024 01:49:20 -0500 (EST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41T21Hmt019414 for ; Thu, 29 Feb 2024 06:47:13 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3wf7ccmj1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:12 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 41T5jjei015367 for ; Thu, 29 Feb 2024 06:47:12 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2100.outbound.protection.outlook.com [104.47.70.100]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3wf6wa8a86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 29 Feb 2024 06:47:12 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) by CH2PR10MB4150.namprd10.prod.outlook.com (2603:10b6:610:ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 06:47:10 +0000 Received: from SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc]) by SJ0PR10MB5768.namprd10.prod.outlook.com ([fe80::64bd:3256:48da:16cc%7]) with mapi id 15.20.7316.039; Thu, 29 Feb 2024 06:47:10 +0000 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 140 seconds by postgrey-1.37 at lists.libvirt.org; Thu, 29 Feb 2024 01:49:21 EST ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NilzOaBP6EsiV37IPCi99iDv7lzaNHd2FXiorqYtLfsDLzWVy9Fw+mFYmG3Vd8hdK282PRWU96dWLkW7AeObQpHiGL0tVxR+xpQvbHHdAlnepezThRriyG3AcqqNEeyUAllrXsnbLbVaVgKkFA2PIg/JQvguDdtkxqCxqjI5GCRAyGbmnMxlHxRXsfqXfugrLj9M4KKCRxU3K19JuDqxt52Bq2IMmVz9afGlXQMZMFtkbgPYcW/cg0n35KZc66P2x9Xki4vWvzCKRbogRtd8jCafWwlU/+RGXGv4LxrEp9a3GzZZ0NmgXng4meC4t3JpmeUxJIEMmCFFVlttU4R/PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ARuWFNs93Br/7Y53izPIRr5PFVG3MgDOcHOMOxXwiek=; b=btnuIJQecKds9/SUZA1Mse4gIchZ8fIm7PendN6BEbmRg5CMvr5fCgg9FJGDIpR+4QClMw7xMfa+LTnqLYFPAOQinOLtl80HdnH87EdMhSmGkzvQz2FWPuxxYxRlFKYTRZGzFFhScqP2DRzHfSmIrxFCFEcZES5OWlwH2AGekP2WuQcxEi9ulbs3GSgSeYxCWft1nwqUqR1lBzwt1L44poNvmdcgVixaG2nJDrs8CNTVccBuCU7Jctd/b38XlFo9jrKCIksMnrE+YtpFYwJPfan4ZiBQygu0N99N/7X1ne+agZGVP+3utKMmR+koDDyvcPwq+b3IvcLa1OWhzpEdZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none From: Shaleen Bathla To: devel@lists.libvirt.org Subject: [libvirt] [PATCH 4/4] tests: virrotatingfiletest: update virRotatingFileWriterAppend Date: Thu, 29 Feb 2024 12:16:39 +0530 Message-Id: <20240229064639.1731653-5-shaleen.bathla@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240229064639.1731653-1-shaleen.bathla@oracle.com> References: <20240229064639.1731653-1-shaleen.bathla@oracle.com> X-ClientProxiedBy: SJ0PR03CA0335.namprd03.prod.outlook.com (2603:10b6:a03:39c::10) To SJ0PR10MB5768.namprd10.prod.outlook.com (2603:10b6:a03:421::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5768:EE_|CH2PR10MB4150:EE_ X-MS-Office365-Filtering-Correlation-Id: fb96ae4b-0c5e-4681-4ea7-08dc38f240c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bZo2TLYQ8i1MQfR/TOm/pxxNthQLSDlen5tHfE0zm/ixFq/Z2kmPb/hudqDhUNKrRSJa5+WKC1fXCh3c4oMsgXSeBIaUm/h9T8lltUkNYdUwFDCJyGOlLMI1kiksWzgvAfSu6DOfmavnDKCmil9pTkLVeKTczutfL5AjxmGsM0YxCE19erVO8jWsBti3el5ZV+r3ROU281loFYzTHwqzyEuXYvoOfbiwkqF45M6koOdG7j2mDUqFwN5CSHvVNS4pSC6KwB7uQQ7dSjPXjBTxOvRip+soh0/QAA73ebGUm2pF3WadmaLQPtbv7vgwrJ0ENQHLdOjSScCQdLCr716y3zpNmnQKVnLqE948BePSMNWcxe0bAJc386NcLkdZXM9gv9EF+H2ploPgmOPK74W612Eh8b7caNfGAuMJObBSkLDtaamyJJWjwhBRYzIRbg6k4kz1A7mZPQvyOMq6GzlEWwjYvc+TZYHbrrm6yReFrhqoKATJQ4E1nVpJq8fRVV4XZOQNQ8vpuPHjb/tm7/XRd9IRfiYtgAQ3ImV5lZo4xiy5r6aCqy2GQYYLgvS/4x1yeH8irz2WOKBECx0byU47W03fNCov/eZ0q91ArmoNAhJ5pfFK4DBA+0+327QO9DSCs8fYmusVVQmkoQgze/vJVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5768.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?LXcfiPqOAGmfxtNw1wvOBRi7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=?us-ascii?Q?EhlHFTBoOOxGHXAeKvGIYW5VBsm8XjCpDQsr4XQh27d62y0VERaL3o7kyMCB?= =?us-ascii?Q?XvZBavsfOd2cTuG/tAi5NVfo5vMUXALQ2ix8+Mu4asVMGaBbsBRJVA4MR8rT?= =?us-ascii?Q?gCJUmYR1jlGju10QcVUb/83ZoRMiXBS3vaPRQ6ChV7Ue2siWRv7gV8Oh1Uvk?= =?us-ascii?Q?GbzpKpLgRiu6v/kn6YC2kycgf+kcVSZ5z6VO6Iyf58gkopdg2d9QeFrYa6tA?= =?us-ascii?Q?Zf3QeIsaUNR/KWHJMmeLSVuKcJYQNLQMGCb8MbZNZssengfgrXWIYP/sWyvO?= =?us-ascii?Q?doCTqTbQjug3buIs0/v777nNQci2Tp/PAHLN4GhCLBdLSmxydv8k5+VWIMKT?= =?us-ascii?Q?/4Z+7kMSAa9/Lk+RzXHlXw73Ow5J7QBrG9umYVaQ8CGN4M0vQoz2Cy/xXffu?= =?us-ascii?Q?DHhJlb8mYReTt9em53mumCJfGPpPiRwjIdKsmppH9Kpp3wd0aMma3MCJq570?= =?us-ascii?Q?8/3TFPifsSqcMYoGaOk+wCOVVhvMW/8X1D5ppPe6Zvm3cRvdrPgdeioKSezh?= =?us-ascii?Q?Vyq5cdxYqw3xs7UoYvmEKwIxRqrpum5RRRv9rlfHnklExVsSzA1+JwTKCLE2?= =?us-ascii?Q?5czSDm6obgqNTjIKkuB/3TgpULuW+/cRu4NE+DMTX6emPmAplWS7NekPhx0g?= =?us-ascii?Q?9z+pmhIIfA/3kQ+foJOFfvuTXECPnthfPkPikqNa3xKga2sHc9ohPWccDF9G?= =?us-ascii?Q?wA=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /58m/XguoANPJ1OriWBEn4IwoR8kz4JyTHcl/68ZJi5rlKMDHJZEmh3F3smBbrkEU43GV8J4PUNAWdQBr6RvNCG5Ml4di/jwN/wnq6sR4rV6bxCin3qh64FxRtPVsItEkUjFnD9HGruCx40cbF1nLUMtWFM+z0b0Pv9OwdbuzSHfUS0s/wzyrFuU24/o2LELLdLDhNykfOXfRUpscGNvgXfkiKa0rEo+DUuqrg2dlATpEkGSOYTyHjYfl6+cBQzoko/xcrucGSWk/a+0HfjZcgkFNJyiv5ZdpE2ML9KDPdjxoSW072l4Gxvv+mWBYet6UC5dilGnxFYCaX/mspYOtucfbEdIH0wDruoe2y+wa1PFBf7VXAj2CSgzOonc7Iwvn4v30saaqLjVb0g2U0a5EurqFfB4c5gd2uFxugfwp6zBjGm/jWH2WQPQATUs7y7H6kn2u+wae3OzeYF/Ahdwye5pc/cdO+yLMSHU6bS8U5UvdhD8bZTMoiDzFJB5w8YoquhY0ecDT4LS5FQF4FwfJSFEC7wczbWe4S+y5lPh4sg6YM/yH7yq1VmNsehfbdg5UciFbYBdrSt37CA4gVDgQlS1A7AQvtikX+IlC4Mo71Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb96ae4b-0c5e-4681-4ea7-08dc38f240c5 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5768.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 06:47:10.0563 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yDq+g6UdW6Ry3QA2bTiz8Qmbz69qknoj0VWpuA2MuZNSQJQ5aaQl7K/t1HczexgAkve2piSz5vo+9yJyZaZ65wGBZgewKQPFWnDVovvVCMI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4150 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_08,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402290051 X-Proofpoint-ORIG-GUID: e0d57BfWaN8Lzh6CIEr_odigPY2MH80s X-Proofpoint-GUID: e0d57BfWaN8Lzh6CIEr_odigPY2MH80s Message-ID-Hash: XHBGVHDBYR56YD4X56ETHOMMTL62SUOO X-Message-ID-Hash: XHBGVHDBYR56YD4X56ETHOMMTL62SUOO X-MailFrom: shaleen.bathla@oracle.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709189485189100001 update virRotatingFileWriterAppend calls by adding timestamp parameter Signed-off-by: Shaleen Bathla --- tests/virrotatingfiletest.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/virrotatingfiletest.c b/tests/virrotatingfiletest.c index ede65848ea54..5ba7235c13da 100644 --- a/tests/virrotatingfiletest.c +++ b/tests/virrotatingfiletest.c @@ -188,7 +188,7 @@ static int testRotatingFileWriterNew(const void *data G= _GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(sizeof(buf), (off_t)-1, @@ -231,7 +231,7 @@ static int testRotatingFileWriterAppend(const void *dat= a G_GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(1024, (off_t)-1, @@ -274,7 +274,7 @@ static int testRotatingFileWriterTruncate(const void *d= ata G_GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(512, (off_t)-1, @@ -317,7 +317,7 @@ static int testRotatingFileWriterRolloverNone(const voi= d *data G_GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(112, (off_t)-1, @@ -360,9 +360,9 @@ static int testRotatingFileWriterRolloverOne(const void= *data G_GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(512, 1024, @@ -405,7 +405,7 @@ static int testRotatingFileWriterRolloverAppend(const v= oid *data G_GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(256, 1024, @@ -448,13 +448,13 @@ static int testRotatingFileWriterRolloverMany(const v= oid *data G_GNUC_UNUSED) =20 memset(buf, 0x5e, sizeof(buf)); =20 - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); - virRotatingFileWriterAppend(file, buf, sizeof(buf)); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); + virRotatingFileWriterAppend(file, buf, sizeof(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(512, 1024, @@ -496,7 +496,7 @@ static int testRotatingFileWriterRolloverLineBreak(cons= t void *data G_GNUC_UNUSE (off_t)-1) < 0) goto cleanup; =20 - virRotatingFileWriterAppend(file, buf, strlen(buf)); + virRotatingFileWriterAppend(file, buf, strlen(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(59, 144, @@ -538,7 +538,7 @@ static int testRotatingFileWriterLargeFile(const void *= data G_GNUC_UNUSED) (off_t)-1) < 0) goto cleanup; =20 - virRotatingFileWriterAppend(file, buf, strlen(buf)); + virRotatingFileWriterAppend(file, buf, strlen(buf), 0); =20 if (testRotatingFileWriterAssertFileSizes(103, 200, --=20 2.39.3 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org