Home > Mobile >  How to parse a field while setting custom index in ingest node pipeline using set processor
How to parse a field while setting custom index in ingest node pipeline using set processor

Time:12-19

I have created a custom index using ingest node pipeline. This is how I have done custom indexing

   [
   {
     "set": {
       "field": "_index",
       "value": "metricbeat-dev",
       "if": "ctx.kubernetes?.namespace== 'dev'"
     }
   }
 ]

Is it possible to include agent version in the index ? Its present as a field in my document. What I expect is metricbeat-dev-7.15.0

CodePudding user response:

Yes, you can append agent version to index name using set processor. I have consider agent version feild name as agent.version

[
      {
        "set": {
          "field": "_index",
          "value": "metricbeat-dev-{{agent.version}}",
          "if": "ctx.kubernetes?.namespace== 'dev'"
        }
      }
    ]
  • Related