redirecting guest serial to file on the host

Andrea Bolognani abologna at redhat.com
Mon Sep 21 07:21:09 UTC 2020


On Sun, 2020-09-20 at 14:41 +0200, daggs wrote:
> Greetings,
> 
> I have a vm to which I can access using virsh console vm1/
> I'd like in addition to be able to dump the serial of the vm in to a file on the host.
> I've found this https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/virtualization_administration_guide/sub-section-libvirt-dom-xml-devices-host-interface but it seems that the first second example which might be suited to what I need doesn't work as I get an empty file:
> here are my serial config for the vm:
> 
>     <serial type='pty'>
>       <source path='/dev/pts/2'/>
>       <target type='isa-serial' port='0'>
>         <model name='isa-serial'/>
>       </target>
>       <alias name='serial0'/>
>     </serial>
>     <serial type='file'>
>       <source path='/var/log/router-serial.log'/>
>       <target type='isa-serial' port='0'>
>         <model name='isa-serial'/>
>       </target>
>       <alias name='serial1'/>
>     </serial>
>     <console type='pty' tty='/dev/pts/2'>
>       <source path='/dev/pts/2'/>
>       <target type='serial' port='0'/>
>       <alias name='serial0'/>
>     </console>
> 
> what might be wrong in the above?

I believe what you're looking for is

  <serial type='pty'>
    <log file='/var/log/router-serial.log' append='on'/>
  </serial>
  <console type='pty'/>

See

  https://libvirt.org/formatdomain.html#consoles-serial-parallel-channel-devices

for more information about configuring serial devices.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvirt-users mailing list