/// <summary> /// Initializes a new instance of the <see cref="SerilogElasticSearchAppService"/> class. /// </summary> /// <param name="config">Configuration.</param> /// <param name="itemsStore">Items Store.</param> /// <param name="logWriter">Log Writer.</param> public SerilogElasticSearchAppService( IConfiguration config, LogItemsStore itemsStore, ILogWriter logWriter) { this.itemsStore = itemsStore; this.logWriter = logWriter; this.node = config.GetConnectionString("ElasticSearch"); this.index = config.GetConnectionString("ElasticSearchIndex"); }
/// <inheritdoc /> public async Task <SystemLogSelectItemsDto> GetSelectItems() { var items = LogItemsStore.GetItems().Select(x => x.DeserializeObject()); return(await Task.FromResult(new SystemLogSelectItemsDto { ApiMethod = items.Select(x => x["apiMethod"]?.ToString()).Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToArray(), ServerAddress = items.Select(x => x["serverAddress"]?.ToString()).Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToArray(), ApiRouter = items.Select(x => x["apiRouter"]?.ToString()).Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToArray(), Title = items.Select(x => x["title"]?.ToString()).Where(x => !x.IsNullOrWhiteSpace()).Distinct().ToArray(), })); }