-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add startDate parameter to WatchLogs() #139
Comments
Hi @paulkva, My imagined use case of the I thought it was pretty nifty seeing a couple of earlier records when specifying |
Hi @paulkva, I have released a pre-release build of PrtgAPI 0.9.13 that includes this enhancement. Can you please follow the manual installation instructions and advise whether this works as expected? Regards, |
I can confirm that the startDate argument is available in the pre-release build, but to be quite frank I had only just barely started to build the logging mechanism that we had been contemplating, so it might be a few more days before I can verify everything works as expected. I'll keep you posted. Thank you so much for the quick response and enhancement! |
Quick update. The proof-of-concept works! One small nitpick is This does get me "close enough" since I can just check for repeat entries, so if increasing date precision proves to be problematic (or if it's out of your control due to PRTG internals) I wouldn't worry about it too much. Thanks again! |
I'm not sure I fully understand what you're doing with your log file, however potentially it may be easier for you to implement implement your own custom The InfiniteLogGenerator class handles the logic of streaming logs from PRTG. Whenever it checks for new logs, I believe you'll find it usuaully returns a bunch of logs you've seen previously as well. Logs that have been seen before are stored in a Since individual log entries don't have a unique identifier, we determine whether two logs are the same by Potentially this infrastructure may assist you in checking for repeat entries |
Our use case is to collect all PRTG logs that appear on the front end into Splunk via serializing them to JSON and writing them to local files. We plan to use that data to detect patterns over time that PRTG might not alert us to, e.g. an unstable sensor which jumps between "warning" and "up" frequently without ever reaching "down" status. We also generally find Splunk easier for investigation than PRTG's log UI. We want to be able to get previous logs without duplicates so that we can ensure continuity if/when the collection process stops running for a while. To do that, we read the most recent entry we had previously written and use its As for comparing two As I said, I don't think our use case requires any further changes to PrtgAPI, but I hope that's helpful context. |
What are you trying to do, and to what extent does PrtgAPI provide existing functionality around this?
The Powershell command
Get-ObjectLog -Wait
also respects the-StartDate
argument, and it initially returns all logs from the specified StartDate before entering "wait" mode.The C# equivalent,
WatchLogs()
, does not accept astartDate
argument, and replicating the Powershell functionality would require multiple calls (GetLogs()
followed byWatchLogs()
) and I think would have a slight risk of a race condition (if PRTG emits a log entry in between the two calls).Is this something that has some sort of parallel in the PRTG UI? If so where do you go/how do you normally do it?
This is something that has a parallel in PrtgAPI's Powershell implementation. 😃
We are trying to collect all PRTG logs into our Splunk instance. Based on a series of searches, I haven't found any option as robust as PrtgAPI. Using C# instead of Powershell would allow us to more easily pull the credentials we need securely, but without this functionality in C# we will likely try to accomplish this via Powershell.
Due Diligence
Please enter an 'x' between the brackets to indicate you have done these
The text was updated successfully, but these errors were encountered: