From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id CCA915A0268 for ; Thu, 23 Feb 2023 19:15:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677176119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xt7Rwaf2qINY/FovRRrZB/ISN+ZemlkasXYTUfWD3ew=; b=XXYFtRZOBw+n72fqEZ8J8spTJhgoTrSbOuKk09Yc17E+OTFLr64g3EUkspJca58l1bP+VX tJxKQkUZrwIvMOYtHjb29ANtVi1Zksoh3w7UvTxEKg0Belf5OmLFyBOx4PEpextjOViy6K X8xrRSJHCvg6JkSIxAmYY9Lc0jvxifA= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-67-sRo_GtnwNMGJYcO8tcCYcA-1; Thu, 23 Feb 2023 13:15:18 -0500 X-MC-Unique: sRo_GtnwNMGJYcO8tcCYcA-1 Received: by mail-pj1-f72.google.com with SMTP id fy8-20020a17090b020800b002374c592205so39671pjb.5 for ; Thu, 23 Feb 2023 10:15:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:in-reply-to:mime-version:references :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xt7Rwaf2qINY/FovRRrZB/ISN+ZemlkasXYTUfWD3ew=; b=fmjXdTgDWTTWNiPQKU4RdVcmDJf9AkDSay+hCr42OwpyCHkDJwW35wUBEp1Hgl2N7i bVHP5/6AOU1jO2piN/r/6DuALSjRL8kCGaAqLpsL0mIjZipd+HPQxQCWsc2AOp/JaeIL U4p0YGcuXKY3anwhHJgUb1OMe/MvP23TIdykyoVfXnEYgFz+M9SznnYuLdTeBYGXEcf6 RcO0rqFasIeid8jpVOUpFCAY1Mux0ANl/H3CdJz25PhQdEcYh2wscQK5Hjc3djT16tKx qYM1N9yAI5Bi389ZHAt2FOjNDWOm9M5guRm4b47JKl3GdEwff77+XqabIMolsgLSdtZs gGgw== X-Gm-Message-State: AO0yUKVsb5ijTGTzhwWndMGdRan5g3ERszEM32xawCx/V3Tui7YZRhzV jpb1yGJ7Qn40tqlW1uYW9ObTIeEcUTcOSc5OvYSCyZFnRx/sCNYAh0MD4dcnUUVlGF88Thxa5uY QsHkIr1IudiUr42YddkVGd3e6vNTN X-Received: by 2002:a17:90a:6ba4:b0:236:6a41:68fb with SMTP id w33-20020a17090a6ba400b002366a4168fbmr652602pjj.5.1677176117081; Thu, 23 Feb 2023 10:15:17 -0800 (PST) X-Google-Smtp-Source: AK7set/3j8FwLzzxYqEGfRtOrlnwrk9SSdzll6/eZNlug98olbT3HT8RN14mV1e2oDSjXxLzW7FQSN23t3sdl0JiG1g= X-Received: by 2002:a17:90a:6ba4:b0:236:6a41:68fb with SMTP id w33-20020a17090a6ba400b002366a4168fbmr652590pjj.5.1677176116639; Thu, 23 Feb 2023 10:15:16 -0800 (PST) Received: from 744723338238 named unknown by gmailapi.google.com with HTTPREST; Thu, 23 Feb 2023 10:15:15 -0800 From: Andrea Bolognani References: <20230223173555.3896768-1-sbrivio@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230223173555.3896768-1-sbrivio@redhat.com> Date: Thu, 23 Feb 2023 10:15:15 -0800 Message-ID: Subject: Re: [PATCH] log: Send identifier string in log messages, openlog() won't work for us To: Stefano Brivio X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Message-ID-Hash: TNWBHXQAJJCFCHIAA5RJLFIHUS6AYVUS X-Message-ID-Hash: TNWBHXQAJJCFCHIAA5RJLFIHUS6AYVUS X-MailFrom: abologna@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Feb 23, 2023 at 06:35:55PM +0100, Stefano Brivio wrote: > openlog() can be used to set "ident" and have all the log messages > prefixed by it, but only if we call syslog() -- this is implemented > by C libraries. > > We don't log messages with syslog(), though, as we have a custom > implementation to ensure we don't need dynamic memory allocation. > This means that it's perfectly useless to call openlog(), and that we > have to prefix every message we log by the identifier on our own. > > Reported-by: Andrea Bolognani > Signed-off-by: Stefano Brivio > --- > log.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) With this patch applied, the entries I see in the journal after starting a VM go from passt.avx2[519959]: No external routable interface for IPv6 passt.avx2[519959]: Outbound interface (IPv4): enp5s0 MAC[519959]: host[519959]: xx:xx:xx:xx:xx:xx DHCP[519959]: assign[519959]: 192.168.1.62 mask[519959]: 255.255.255.0 router[519959]: 192.168.1.1 DNS[519959]: passt.avx2[519959]: 192.168.1.1 passt.avx2[519959]: DNS search list: passt.avx2[519959]: xxx passt.avx2[519959]: UNIX domain socket bound at /run/libvirt/qemu/passt/12-xxx-net0.socket passt.avx2[519959]: You can now start qemu (>= 7.2, with commit 13c6be96618c): passt.avx2[519959]: kvm ... -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=/run/libvirt/qemu/passt/12-xxx-net0.socket passt.avx2[519959]: or qrap, for earlier qemu versions: passt.avx2[519959]: ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio passt.avx2[519960]: accepted connection from PID 0 DHCP[519960]: ack to request passt.avx2[519960]: from xx:xx:xx:xx:xx:xx to passt[523786]: No external routable interface for IPv6 passt[523786]: Outbound interface (IPv4): enp5s0 passt[523786]: MAC: passt[523786]: host: xx:xx:xx:xx:xx:xx passt[523786]: DHCP: passt[523786]: assign: 192.168.1.62 passt[523786]: mask: 255.255.255.0 passt[523786]: router: 192.168.1.1 passt[523786]: DNS: passt[523786]: 192.168.1.1 passt[523786]: DNS search list: passt[523786]: xxx passt[523786]: UNIX domain socket bound at /run/libvirt/qemu/passt/13-xxx-net0.socket passt[523786]: You can now start qemu (>= 7.2, with commit 13c6be96618c): passt[523786]: kvm ... -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=/run/libvirt/qemu/passt/13-xxx-net0.socket passt[523786]: or qrap, for earlier qemu versions: passt[523786]: ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio passt[523789]: accepted connection from PID 0 passt[523789]: DHCP: ack to request passt[523789]: from xx:xx:xx:xx:xx:xx which is clearly much better. Tested-by: Andrea Bolognani Reviewed-by: Andrea Bolognani Note the change from passt.avx2 to passt. Looking at the process listing, plain passt was used in both cases, so I assume that the passt.avx2 mention is journald trying to fill in the blanks and getting it wrong? -- Andrea Bolognani / Red Hat / Virtualization