Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. System event logs
QtWS25 Last Chance

System event logs

Scheduled Pinned Locked Moved Solved General and Desktop
systemlogs
11 Posts 4 Posters 7.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Max13
    wrote on last edited by
    #1

    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!

    We all have started by asking questions. Then after some time, we can begin answering them.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        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.

        M Offline
        M Offline
        Max13
        wrote on last edited by
        #3

        @SGaist Thanks but my question is on HOW can I retrieve the system event logs, no how to send them.

        We all have started by asking questions. Then after some time, we can begin answering them.

        1 Reply Last reply
        0
        • Paul ColbyP Offline
          Paul ColbyP Offline
          Paul Colby
          wrote on last edited by
          #4

          @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.

          1 Reply Last reply
          1
          • M Offline
            M Offline
            Max13
            wrote on last edited by
            #5

            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

            We all have started by asking questions. Then after some time, we can begin answering them.

            kshegunovK 1 Reply Last reply
            0
            • Paul ColbyP Offline
              Paul ColbyP Offline
              Paul Colby
              wrote on last edited by
              #6

              @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.

              1 Reply Last reply
              1
              • M Max13

                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

                kshegunovK Offline
                kshegunovK Offline
                kshegunov
                Moderators
                wrote on last edited by kshegunov
                #7

                @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 as rootto 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.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply
                1
                • M Offline
                  M Offline
                  Max13
                  wrote on last edited by
                  #8

                  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.

                  We all have started by asking questions. Then after some time, we can begin answering them.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    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 ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      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 ?

                      M Offline
                      M Offline
                      Max13
                      wrote on last edited by Max13
                      #10

                      @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

                      We all have started by asking questions. Then after some time, we can begin answering them.

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Like I wrote, pure curiosity :)

                        AFAIK, asl would be a starting point.

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved