Serilog 无法登录elasticsearch

Serilog unable to loginto elastic search

我创建了一个简单的 C# 程序。它将 serilog 配置为使用弹性搜索接收器,如下所示

string url = "http://localhost:9200/";
var logger = new LoggerConfiguration()
            .WriteTo.LiterateConsole()
            .WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(url)))
            .CreateLogger();
logger.Error("This is an error Message");

我可以在 literate console 中看到日志,但在 elastic search 中什么也看不到。我是否需要在弹性搜索接收器选项中创建和指定索引?我在这里做错了什么?

就我而言,这是因为安装 x-pack 后出现身份验证问题。 我通过添加

暂时禁用了它
xpack.security.enabled: false

在 elasticsearch.yml 和 kibana.yml 中。之后就开始工作了。