System event logs
-
Hello all! I'm managing approximately 30 cash registers around the world for my company, mainly on Windows XP.
Instead of connecting every day to check if the system is well (if I don't do it, someone else will). Is there a way to retrieve the system event logs using Qt?
I would like either send it to me by email or POST them to an API I'll write.
Thank you for your help!
-
Hi,
It depends partly on how you connect to them and what you have to do to check they are working fine.
If you want to send the logs to a web service then you can use QNetworkAccessManager.
If you can automate the connection then you can write a little helper tool that does the connection and retrieve the log. and show them.
-
@Max13 said:
HOW can I retrieve the system event logs
This is something very specific to Windows, so I'd recommend you ask somewhere like the MSDN forums too.
Windows provides a platform-specific API for accessing the Windows Event Log. If I remember correctly (it's been a while since I written code in this area), you'll need to subscribe your application to the Windows Event Log - probably in a "pull" mode in this case (otherwise you'd probably need to register a Windows Service to get all entries reliably).
Cheers.
-
OMG... Thank you a lot, but it seems complicated... As something I've found earlier, which also seems very complicated for someone who has never seen the Windows APIs Querying for event information, do you think it could be what I need?
BTW, it's true that the System Event log is Windows specific, but there is also one in UNIX/Linux systems, even if it's known as
syslog
, Qt could have implemented something platform independent to get these.Thank you
-
@Max13 said:
As something I've found earlier, which also seems very complicated for someone who has never seen the Windows APIs Querying for event information, do you think it could be what I need?
Yes, that looks like it would probably get you want you want (assuming your program has the correct privileges).
BTW, it's true that the System Event log is Windows specific, but there is also one in UNIX/Linux systems, even if it's known as syslog, Qt could have implemented something platform independent to get these.
I don't really think you can compare syslog to Windows Event Log... syslog only provides an API for applications to submit log messages (and often the back-end infrastructure to federate those messages to a central location), it does not provide any standardised way of reading / fetching those log messages (unless you call parsing log files "standard", which you can't really in this case, since the format of those log files is configuration based, varies from implementation to implementation, often split into multiple separate files per facility / level, often log-rotated by third party processes, and often omitted from disk entirely when federating, centralising, or just plain conserving disk space). Whereas Windows Event Log provides an API for both creating and retrieving (where access has been granted) log messages.
So while it might make sense for Qt to provide a standardised "system level logging" API, I think its unrealistic (though not impossible) to think Qt would provide a cross-platform API for enumerating and fetching system level log messages on all supported platforms. Would be awesome if it did though :)
Good luck with the Windows API. Its not that bad once you get the hang of it :)
Cheers.
-
@Max13 said:
BTW, it's true that the System Event log is Windows specific, but there is also one in UNIX/Linux systems, even if it's known as syslog, Qt could have implemented something platform independent to get these.
The
/var/log/syslog
is a system file that requires elevated privileges to read, so you'd need your application to be running asroot
to access it. Additionally it's simply a text file. On one hand, Qt doesn't presume you run your applications as a super user (deamons are used for such things), and on the other (provided you do run with elevated privileges), you can simply read it as you'd read any other text file. -
Alright alright. I've tried ;-)
I will make it a service (and Open source), transparent to the user (because it's already a mess asking a user to restart the computer) which will check the day's event logs and POST them to an API I'll make to make it clear and easy to read.
Thank you all for your help, I'll try to keep you updated.
-
Sorry, I misunderstood your needs. I thought you wanted to propagate the logs generated by an application you had on these devices.
Out of curiosity, will you be also targeting OS X ?
-
@SGaist Hey, why not. I don't know where to begin, but why not. Why do you ask ?
For the others, I might have found a simpler way: http://stackoverflow.com/questions/25752409/how-can-i-export-my-event-logs-to-a-folder-csv-or-txt-on-every-start-up-automa