markmcdowell / NLog.Targets.ElasticSearch

NLog target for Elasticsearch
MIT License
176 stars 89 forks source link

Unable to create third index in elastic search for logging using NLog in Asp.net core #158

Open sb00820016 opened 2 years ago

sb00820016 commented 2 years ago

0

Hello Everyone, I am new to the elk stack and trying to do logging using elastic search. I want to create different index for different different services in api. I am able to create two indexes of different services but can not do the same for third index.

Following is my nconfig file

[](<?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" autoReload="true" throwExceptions="false" internalLogLevel="Trace" internalLogFile="c:\temp1\nlog-internal.log">

<extensions>
    <add assembly="NLog.Targets.ElasticSearch"/>
    <add assembly="NLog.Web.AspNetCore"/>
</extensions>

) As you can see above indexes aquaparallelapi and aquaparallelapiprogress is created and gives the desired result but index aquaparallelapitestcase is not created. When I tried to do

http://localhost:9200/aquaparallelapitestcase

then

{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index [aquaparallelapitestcase]","resource.type":"index_or_alias","resource.id":"aquaparallelapitestcase","index_uuid":"na","index":"aquaparallelapitestcase"}],"type":"index_not_found_exception","reason":"no such index [aquaparallelapitestcase]","resource.type":"index_or_alias","resource.id":"aquaparallelapitestcase","index_uuid":"na","index":"aquaparallelapitestcase"},"status":404} Please let me know where I am wrong?