[pve-devel] [PATCH qemu-server 2/2] swtpm: use start time as prefix for logging

Fiona Ebner f.ebner at proxmox.com
Wed Jan 18 13:21:09 CET 2023


to be able to distinguish different invocations.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 PVE/QemuServer.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 97d60e2d..e6aa62eb 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3252,6 +3252,9 @@ sub start_swtpm {
 	});
     }
 
+    # Used to distinguish different invocations in the log.
+    my $log_prefix = "[id=" . int(time()) . "] ";
+
     my $emulator_cmd = [
 	"swtpm",
 	"socket",
@@ -3264,7 +3267,7 @@ sub start_swtpm {
 	"--terminate", # terminate on QEMU disconnect
 	"--daemon",
 	"--log",
-	"file=/run/qemu-server/$vmid-swtpm.log,level=1",
+	"file=/run/qemu-server/$vmid-swtpm.log,level=1,prefix=$log_prefix",
     ];
     push @$emulator_cmd, "--tpm2" if $tpm->{version} eq 'v2.0';
     run_command($emulator_cmd, outfunc => sub { print $1; });
-- 
2.30.2






More information about the pve-devel mailing list