How get all event server log for a certain period/for full working period by a request?

Hi!

I want to get server events for a certain period, but I only find method for getting events real time.

I can’t find method/function for getting all events server log for the certain period/for full working period of server by a request.

Is there such a function?

Or how I can request the event server to send me events for the certain period?

The Alarm and Event Viewer sample does show you how to read historical events and subscribe to events as they happen. The read of saved events is

happening at start-up.

https://doc.developer.milestonesys.com/html/index.html?base=samples/alarmviewer_sample.html&tree=tree_2.html

However all events are not saved by the Milestone Event Server and this is by design to avoid saving to much data that can potentially bring the server down.

You can make more events available historically by changing settings on which events are saved and the retention of those events. We recommend never to

save all events, because it might lead to a risk to fill up the database if you keep them all. (That is why you can only get the real time events with default

setting.)

If you need to change the save and retention of events, please see following instructions; Start Management Client, go to Tools and select Options, click

Alarms and Events tab and select retention time. Most default settings are set as “0” retention time. You can change the settings; we don’t recommend changing “System Event”.

Good day! Thanks for the answer!

Yes, it was about this example that I spoke.

In the AlarmEventViewer example, using the GetEventLines method, you can get events numbered from A till B. But these numbers are not constant (conditional), because they are updated when a new event is received. Therefore, we cannot confidently say what event numbers we need.

IAlarmClient alarmClient = _alarmClientManager.GetAlarmClient(EnvironmentManager.Instance.MasterSite.ServerId);
 
                EventLine[] events = alarmClient.GetEventLines(0, 100,
                    new VideoOS.Platform.Proxy.Alarm.EventFilter()
                    {
 
                    });

This method does not quite suit us. Since, in order to know the events for a certain period of time, we first need to request all the events, and then determine what we need. Is there a way to find out the total number of all events on the server?

We want to implement the following:

The client receives events from the server in real time (or does not receive them at all). After some time, the connection between the client and the server disappears. Then the connection resumes. And you need to get all the events from the event server for the past time when there was no connection.

Can this be done? Is there any way to send a request to the event server, for example, “send me events from 00:00 till 04:00”?

It is possible to use the EventFilter and ask for data limiting on the timestamp.

Snippet of code –

DateTime dtFrom = DateTime.UtcNow.AddMinutes(-4); 
DateTime dtTo = DateTime.UtcNow.AddMinutes(0); 
EventLine[] events = alarmClient.GetEventLines(0, 10000, 
    new VideoOS.Platform.Proxy.Alarm.EventFilter() 
    { 
         Conditions= new Condition[] { 
             new Condition() { Operator = Operator.GreaterThan, Target= Target.Timestamp, Value= dtFrom }, 
             new Condition() { Operator= Operator.LessThan, Target= Target.Timestamp, Value= dtTo} 
         } 
}); 

I think this should help me!

Thank you very much for your help! :+1: