Thanks, it is working now but I have anther problem.
For every call to the API for example
public IEnumerable<WeatherForecast> Get() a lot is written to the EventLog not just
_logger.LogInformation("aaa"); so I have tried to implement a filter like this
eventLogSettings.Filter = (x, y) => y >= LogLevel.Error; so only the logs I am writing and also Error's from the API will be written to the EventLog but I have no luck of doing so as when applying this filter nothing is written to the EventLog.