Problem with ElasticSearch username and password using serilog

I'm using the serilog in my ASP.NET Core app to log data to ElasticSearch. My code was working fine when the was disabled. I enabled the security and defined passwords for default users (elastic, apm_system, kibana, logstash_system, beats_system, remote_monitoring_user). I logged into elastic and kibana without any problem. But when I run my application, it doesn't log data in elasticsearch.

Serilog configuration is like this:

private Action<AbpBootstrapperOptions> ConfigSerilog()
    var configuration = new ConfigurationBuilder()
    var config = new LoggerConfiguration()
    return options => options.IocManager.IocContainer.AddFacility<LoggingFacility>(f => f.LogUsing(new SerilogFactory(config)));

and my serilog.json file is like this:

"WriteTo": [
          { "Name": "Console" },
            "Name": "Elasticsearch",
            "Args": {
              "nodeUris": "http://serilog:mypasswordhere@localhost:9200",
              "indexFormat": "logstash-{0:yyyy.MM.dd}",
              //some other configs

I guess the problem is with "serilog" user, and I have to define a new user. But I'm not sure about it and I don't know what roles to assign to this new user.

I also tried to get a list of current users and their roles, but it had no result:

elasticsearch-users list No users found

I think it just shows user-defined users, but not sure about it either.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.