-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging of QEMU command line and QMP #1240
Comments
Yeah, we could certainly write more info into What we need to be careful with though is that user action inside the guest should not be able to grow that log. Otherwise we're risking a denial of service type attack from the guest. So we definitely don't want to log all the QMP events as some of those are guest-triggered. |
I thought that the log file could have size limit and delete oldest entries so it doesn't grow indefinitely. About responses I understand. They are empty most of the time anyway. I also found out that output from variable But the most important to log are the QEMU init command and Incus QMP commands. |
Ah yeah, we probably wouldn't want to send the ringbuf-read ones as that doesn't really do anything to the VM config anyways. Making the file on disk be effectively a ringbuffer (trim old stuff as you write new entries) is a bit tricky because of having to deal with concurrent access/writes, I'd rather not have to deal with that by just limiting the amount of stuff written. |
Hi! I see the issue has no assignee; if nobody is working on it, I can give it a shot |
I’m not sure writing to the same file as QEMU is completely safe. OTOH having a third QEMU log file seems confusing. What do you suggest?
If we’re only considering the commands used before POST, logging their responses looks fine to me. But not everyone would be interested in these logs, so do we want to introduce yet another™ configuration key to specify the file in which we should log that? What would be the key name? Where would the file be? If it’s in I need to clarify these points before writing any code. |
So I think we can do As for its content, I think we should only log the commands we send out and the response we're getting back rather than log all QMP traffic. This will avoid us growing the log purely as a response to guest activity. We also need to filter some of our own commands, specifically the ringbuf stuff as that would otherwise grow the file in an unsustainable way. |
Alright, so
|
I suspect something more log-ish will be better, possibly something like:
So same prefix length for both requests and reply so it's easy to read through with blank line between entries, that should make it easy to grep/parse and to visually follow. |
Yeah, about that… We may have two contradictory goals at play here… What exactly are the XYZ? |
I'd likely keep request and response as JSON and on one line. It's not the easiest to read but also not too terrible and it makes it easy to parse/extract and dump into I'd probably do something like |
Okay then, I think I have everything I need :) |
Thanks for your work @bensmrs |
Oh I forgot about that… @stgraber, would |
Hmm, I actually don't think we need to actively log that. If QEMU starts properly, then you will see the command line in the process most, if it fails to start, we already show it in the error message. If it was easy to add to early.log, I wouldn't be opposed to duplicating it there, but as you said, that's not exactly easy as the subprocess package clears it. |
I was considering adding it as a Debug entry to the logger. It’s 2 lines of code, I’ll let you accept or reject the PR. |
Hi,
as written here, the QMP is currently very opaque and you plan to move away from config file and use only QEMU command line and QMP.
I thought that for debugging purposes it would be nice if QEMU command line and QMP commands/responses were logged so people can see what exactly is configured.
For QEMU command line, specifically the init command I think it would be enough to setup logging here.
incus/internal/server/instance/drivers/driver_qemu.go
Line 1704 in 58bdbb5
Either just the
qemuCmd
or the whole thing withp
variable.For QMP that would mean logging
request
andout
variables and filtering them bym.path
.incus/internal/server/instance/drivers/qmp/monitor.go
Line 188 in 58bdbb5
Then I think saving as file in appropriate folder in
/var/log/incus/
would be best.When I tried modifying my self-compiled Incus, print was enough for me, because I am not capable making robust solution.
resp
also seems to have some useful info.incus/internal/server/instance/drivers/qmp/monitor.go
Line 182 in 58bdbb5
A lot is empty but when printed I also got this when starting stock Windows VM install.
So this could also be logged to file.
Edit: Actually not needed, included in QMP output Logging of QEMU command line and QMP #1240 (comment)
Currently I have to compile my own Incus and add print statements to get to these commands and logs. I think if this was all logged in files inside
/var/log/incus/
that would be great for debugging.Thanks for consideration.
The text was updated successfully, but these errors were encountered: