public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Andrea Bolognani <abologna@redhat.com>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] log: Send identifier string in log messages, openlog() won't work for us
Date: Thu, 23 Feb 2023 10:15:15 -0800	[thread overview]
Message-ID: <CABJz62NKZrMzabA9FYP680ukcdmt5R+9a6AZEBdeH0VJsyw-Hg@mail.gmail.com> (raw)
In-Reply-To: <20230223173555.3896768-1-sbrivio@redhat.com>

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 <abologna@redhat.com>
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
>  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 <abologna@redhat.com>
  Reviewed-by: Andrea Bolognani <abologna@redhat.com>

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


  reply	other threads:[~2023-02-23 18:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 17:35 [PATCH] log: Send identifier string in log messages, openlog() won't work for us Stefano Brivio
2023-02-23 18:15 ` Andrea Bolognani [this message]
2023-02-24  6:59   ` Stefano Brivio
2023-02-24 19:44     ` Andrea Bolognani
2023-02-23 23:31 ` David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABJz62NKZrMzabA9FYP680ukcdmt5R+9a6AZEBdeH0VJsyw-Hg@mail.gmail.com \
    --to=abologna@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).