/// <summary> /// Получить количество записей в seq по заданным условиям /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <CountResponse> GetCountOfLogs(LogsRequest request) { CountResponse response = new CountResponse(); _seqConnection = new SeqConnection(_configuration["SeqUrl"], "autxb7drQIW5afVHz4Nz"); if (!_seqConnection.EnsureConnectedAsync(new TimeSpan(100)).IsCompleted) { _seqConnection = new SeqConnection(_configuration["SeqUrl"], "autxb7drQIW5afVHz4Nz"); } List <LogsRequest> logs = new List <LogsRequest>(); //var installedApps = _seqConnection.Apps.ListAsync(); //string login = request.Login; //string reqPath = request.RequestPath; //var resultSet = await _seqConnection.Events.ListAsync( // filter: $"login = '******' AND RequestPath = '{reqPath}'", // render: true, // fromDateUtc: request.BeginDate, // toDateUtc: request.EndDate, // count: 100) ; //все записи в базе по указанным фильтрам string login = request.Login ?? "noLogin"; string reqPath = request.RequestPath ?? ""; string lastReadEventId = null; while (true) { var resultSetFull = await _seqConnection.Events.InSignalAsync( filter : $"login = '******' AND RequestPath = '{reqPath}'", render : true, fromDateUtc : request.BeginDate, toDateUtc : request.EndDate, afterId : lastReadEventId, count : 100000); //foreach (var evt in resultSetFull.Events) // logs.Add(new LogRequest() { TimeStamp = Convert.ToDateTime(evt.Timestamp), Message = evt.RenderedMessage }); response.Count += resultSetFull.Events.Count(); if (resultSetFull.Statistics.Status != ResultSetStatus.Partial) { break; } lastReadEventId = resultSetFull.Statistics.LastReadEventId; } //foreach (var evt in resultSet) //{ // //можно сделать фильтр по уровню ошибки // //if (evt.Level == "Error") // logs.Add(new LogRequest() { TimeStamp = Convert.ToDateTime(evt.Timestamp), Message = evt.RenderedMessage }); //} return(response); }
public IActionResult Index() { var request = new LogsRequest(); var response = mediator.Send(request); var logs = response.Result.Logs.Take(10).ToList(); return(View(logs)); }
private void RequestLogs() { var request = new LogsRequest( LogsControl.SelectedRoundId, LogsControl.SelectedTypes.ToList(), null, null, null, LogsControl.SelectedPlayers.ToArray(), null, null, DateOrder.Descending); SendMessage(request); }
public LogsResponse ProcessGetLogs(LogsRequest objRequest) { try { { objLogs.LogResponse = objclsDashboard.GetLogsDashboard(objRequest.tblName, objRequest.RequestId); return(objLogs); } } catch (Exception) { return(objLogs); } finally { objLogs = null; objclsDashboard = null; } }
public async Task <CountResponse> GetDiasUserActivity(DiasUserActivityRequest request) { CountResponse countResponse = new CountResponse() { Count = 0 }; LogsRequest logsRequest = new LogsRequest() { AppName = "DIAS", BeginDate = request.BeginDate, EndDate = request.EndDate, Login = request.Login, RequestPath = "/api/data/GetComponentsByRole" }; countResponse = await _logService.GetCountOfLogs(logsRequest); return(countResponse); }
public async Task <CountResponse> GetCountOfLogs(LogsRequest request) { return(await _logService.GetCountOfLogs(request)); }