Logging xm console output in xen?
Question
Is there a way I can log the output of xm console in to some file?
Can I set something in the domain configuration file which automatically does this for me when I issue xm create?
I tried:
xm console | tee domU-console.log
... , but that does not fit in my case. I want to log the output asynchronously in background.
Solution
If that works then you ought to be able to :
nohup xm console | tee domU-console.log &
I don't know if xm console
uses stderr at all but if you want to be sure to snag tht output, too, do this:
nohup xm console 2>&1 tee domU-console.log &
Drop the tee
if you intend on logging out.
OTHER TIPS
Your can try xenconsoled like
xenconsoled --log=guest --log-dir=/var/log/xen/guest/
And Redhat also save guest console output to /var/log/xen/console, if you set /etc/sysconfig/xend with XENCONSOLED_LOG_GUESTS=yes.
Procedure 1: Access to Console of Single Guest VM
1: Open XenCenter, go to General tab of the VM which you want access, and check for the UUID
2: Open XenServer text console, run the list_domains command, and find the VM UUID in the output
3: Run the following command to access guest VM console:
/usr/lib/xen/bin/xenconsole < domain id >
Procedure 2: Log Output of Newly Created Linux VMs to Text File
To collect and save output from all VMs running on the XenServer host, complete the following procedure:
1: Run the following command on XenServer host:
xenstore-write /local/logconsole/@ /tmp/console.%d.log
2: Restart the VM from which you want to collect the console output.
3: Verify if file /tmp/console..log exists. This file should contain VM console output. To find domain ID, refer to Procedure 1: Access to Console of Single Guest VM.
4: Run the following command to stop logging console output:
xenstore-rm /local/logconsole/@