nanovms / ops

ops - build and run nanos unikernels
https://ops.city
MIT License
1.26k stars 131 forks source link

Hyper-v instances logging #880

Open fabioDMFerreira opened 3 years ago

fabioDMFerreira commented 3 years ago

547

We can track hyper-v virtual machines log by attaching a Windows named pipe to a COM port and reading its content. However, reading the content of the named pipe from WSL seems not being supported yet.

The next library uses a workaround to read named pipes from WSL https://github.com/jstarks/npiperelay

eyberg commented 8 months ago

we use powershell for a lot of hyper-v ops so can also be utilized here;

PS C:\WINDOWS\system32> Get-VMComPort -VMName *

VMName              Name  Path
------              ----  ----
newg-1702410655     COM 1 \\.\pipe\newg-1702410655
newg-1702410655     COM 2
New Virtual Machine COM 1
New Virtual Machine COM 2
newg-1702410567     COM 1 \\.\pipe\newg-1702410567
newg-1702410567     COM 2
newz-1702426736     COM 1 \\.\pipe\newz-1702426736
newz-1702426736     COM 2

caveats are that the instance needs to be on and you won't get output unless live; https://gbegerow.wordpress.com/tag/powershell-named-pipes/

(for posterity - putty works here)