[RFC] Adding timestamp to guest's serial console log

Hi, Need some comments regarding the following feature : Addition of timestamp support for serial console logs of a guest. We can implement it as a configurable attribute in xml. For example : <serial type='pty'> <log file='$PATH/$GUESTNAME-serial0.log' append='on' timestamp="on/off"/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial> We can add a timestamp after every '\n' character received from qemu. Can I have some comments regarding this change like what I should keep in mind while implementing, whether it is a welcome addition or not, issues I might face, any qemu changes required. Thanks and Regards, Shaleen Bathla

ping -----Original Message----- From: Shaleen Bathla <shaleen.bathla@oracle.com> Sent: Tuesday, June 20, 2023 2:44 PM To: libvir-list@redhat.com Subject: [RFC] Adding timestamp to guest's serial console log Hi, Need some comments regarding the following feature : Addition of timestamp support for serial console logs of a guest. We can implement it as a configurable attribute in xml. For example : <serial type='pty'> <log file='$PATH/$GUESTNAME-serial0.log' append='on' timestamp="on/off"/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial> We can add a timestamp after every '\n' character received from qemu. Can I have some comments regarding this change like what I should keep in mind while implementing, whether it is a welcome addition or not, issues I might face, any qemu changes required. Thanks and Regards, Shaleen Bathla

On 8/29/23 09:04, Shaleen Bathla wrote:
ping
-----Original Message----- From: Shaleen Bathla <shaleen.bathla@oracle.com> Sent: Tuesday, June 20, 2023 2:44 PM To: libvir-list@redhat.com Subject: [RFC] Adding timestamp to guest's serial console log
Hi,
Need some comments regarding the following feature : Addition of timestamp support for serial console logs of a guest.
We can implement it as a configurable attribute in xml. For example : <serial type='pty'> <log file='$PATH/$GUESTNAME-serial0.log' append='on' timestamp="on/off"/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial>
We can add a timestamp after every '\n' character received from qemu. Can I have some comments regarding this change like what I should keep in mind while implementing, whether it is a welcome addition or not, issues I might face, any qemu changes required.
Yeah, this might be useful. We definitely need additional attribute to control this behavior, otherwise we might break some scenarios (e.g. where users transfer binary data via this channel. What I worry though, is that with stdio_handler="file", i.e. when the file is passed to QEMU directly, then this knob won't work. So we would need some changes to QEMU. But then, taking this idea further, if QEMU is changed, then does it make sense to have the same code in libvirt (for stdio_handler='logd' case)? QEMU already has -msg timestamp=on, which controls timestamps for log messages (/var/log/libvirt/qemu/$dom.log). But that may be orthogonal to what you are trying to achieve. Michal

On Tue, Aug 29, 2023 at 11:11:09AM +0200, Michal Prívozník wrote:
On 8/29/23 09:04, Shaleen Bathla wrote:
ping
-----Original Message----- From: Shaleen Bathla <shaleen.bathla@oracle.com> Sent: Tuesday, June 20, 2023 2:44 PM To: libvir-list@redhat.com Subject: [RFC] Adding timestamp to guest's serial console log
Hi,
Need some comments regarding the following feature : Addition of timestamp support for serial console logs of a guest.
We can implement it as a configurable attribute in xml. For example : <serial type='pty'> <log file='$PATH/$GUESTNAME-serial0.log' append='on' timestamp="on/off"/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial>
We can add a timestamp after every '\n' character received from qemu. Can I have some comments regarding this change like what I should keep in mind while implementing, whether it is a welcome addition or not, issues I might face, any qemu changes required.
Yeah, this might be useful. We definitely need additional attribute to control this behavior, otherwise we might break some scenarios (e.g. where users transfer binary data via this channel.
What I worry though, is that with stdio_handler="file", i.e. when the file is passed to QEMU directly, then this knob won't work. So we would need some changes to QEMU. But then, taking this idea further, if QEMU is changed, then does it make sense to have the same code in libvirt (for stdio_handler='logd' case)?
We could declare handler=file to be unsupported for timestamps instead of changing QEMU. I'm not too fussed whether it lives in libvirt or QEMU though With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Tue, Aug 29, 2023 at 11:11:09 +0200, Michal Prívozník wrote:
On 8/29/23 09:04, Shaleen Bathla wrote:
ping
-----Original Message----- From: Shaleen Bathla <shaleen.bathla@oracle.com> Sent: Tuesday, June 20, 2023 2:44 PM To: libvir-list@redhat.com Subject: [RFC] Adding timestamp to guest's serial console log
Hi,
Need some comments regarding the following feature : Addition of timestamp support for serial console logs of a guest.
We can implement it as a configurable attribute in xml. For example : <serial type='pty'> <log file='$PATH/$GUESTNAME-serial0.log' append='on' timestamp="on/off"/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial>
We can add a timestamp after every '\n' character received from qemu. Can I have some comments regarding this change like what I should keep in mind while implementing, whether it is a welcome addition or not, issues I might face, any qemu changes required.
Yeah, this might be useful. We definitely need additional attribute to control this behavior, otherwise we might break some scenarios (e.g. where users transfer binary data via this channel.
What I worry though, is that with stdio_handler="file", i.e. when the file is passed to QEMU directly, then this knob won't work. So we would need some changes to QEMU. But then, taking this idea further, if QEMU is changed, then does it make sense to have the same code in libvirt (for stdio_handler='logd' case)?
Nowadays I don't think that anybody disables logd. You can always report an error if the configuration is not supported. Note that '<log>' is a separate output from qemu, so adding timestamps to that only (via logd) will not break anything trying to communicate via the real PTY side. Just the log file will be binary data intermixed with timestamps at certain points.

On Tue, Aug 29, 2023 at 07:04:22AM +0000, Shaleen Bathla wrote:
ping
-----Original Message----- From: Shaleen Bathla <shaleen.bathla@oracle.com> Sent: Tuesday, June 20, 2023 2:44 PM To: libvir-list@redhat.com Subject: [RFC] Adding timestamp to guest's serial console log
Hi,
Need some comments regarding the following feature : Addition of timestamp support for serial console logs of a guest.
We can implement it as a configurable attribute in xml. For example : <serial type='pty'> <log file='$PATH/$GUESTNAME-serial0.log' append='on' timestamp="on/off"/> <target type='isa-serial' port='0'> <model name='isa-serial'/> </target> </serial>
We can add a timestamp after every '\n' character received from qemu. Can I have some comments regarding this change like what I should keep in mind while implementing, whether it is a welcome addition or not, issues I might face, any qemu changes required.
QEMU does not have ability to add timestamps currently. If it was to be added by libvirt, it will need logic added to virtlogd and would obviously be unavailable in any deployment that disables virtlogd. We recommend using virtlogd to prevent guest denial of service by consuming all disk space, so not a big problem. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (4)
-
Daniel P. Berrangé
-
Michal Prívozník
-
Peter Krempa
-
Shaleen Bathla