Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sb00820016 opened this issue Jun 8, 2022 · 0 comments

Comments

@sb00820016
Copy link

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

[](

<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->

  <target xsi:type="File" name="f" fileName="${basedir}/logs/log.txt"
      archiveFileName="${basedir}/logs/archives/log.txt"
        archiveAboveSize="5242880"
        archiveEvery="Day"
        archiveNumbering = "Rolling"
        maxArchiveFiles="3"
      layout="${longdate} ${uppercase:${level}} ${message}" />



  <target xsi:type="BufferingWrapper" name="ElasticSearch"
  flushTimeout="5000">

  <target  xsi:type="ElasticSearch" name="elastic" index="aquaparallelapi"
          uri="http://localhost:9200"
          layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
  </target>
  
  
  <target xsi:type="BufferingWrapper" name="ElasticSearch"
  flushTimeout="5000">

  <target  xsi:type="ElasticSearch" name="elastic1" index="aquaparallelapiprogress"
          uri="http://localhost:9200"
          layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
  </target>
  
   <target xsi:type="BufferingWrapper" name="ElasticSearch"
  flushTimeout="5000">

  <target  xsi:type="ElasticSearch" name="elastic2" index="aquaparallelapitestcase"
          uri="http://localhost:9200"
          layout ="API:aquaparallelapi|${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
  </target>

<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
        layout="${longdate} ${uppercase:${level}} ${message}" />
-->
) 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant