# Problem with ElasticSearch username and password using serilog

**URL:** <https://discuss.elastic.co/t/problem-with-elasticsearch-username-and-password-using-serilog/233364>\
**Category:** Elasticsearch\
**Created:** [May 19, 2020, 3:44pm UTC](https://discuss.elastic.co/t/problem-with-elasticsearch-username-and-password-using-serilog/233364 "2020-05-19T15:44:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahdieh\_Hosseini](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mahdieh_hosseini/32/68556_2.png) [@Mahdieh\_Hosseini](https://discuss.elastic.co/u/Mahdieh_Hosseini)\
**Post date:** [May 19, 2020, 3:45pm UTC](https://discuss.elastic.co/t/problem-with-elasticsearch-username-and-password-using-serilog/233364/1 "2020-05-19T15:45:00Z")

</div>

I'm using the serilog in my [ASP.NET](http://ASP.NET) Core app to log data to Elasticsearch. My code was working fine when the xpack.security 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()
        .AddJsonFile($"serilog.json")
        .Build();
    var config = new LoggerConfiguration()
        .ReadFrom.Configuration(configuration)
        .CreateLogger();
    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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 16, 2020, 3:45pm UTC](https://discuss.elastic.co/t/problem-with-elasticsearch-username-and-password-using-serilog/233364/2 "2020-06-16T15:45:01Z")

</div>

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