How can we help?
Table of Contents
< All Topics
Print

Category Data update for 2.0.2

We have updated the Policy Categories in version 2.0.0.
There is already trend data being collected for old categories in elastic search. To update the existing data, users need to run the below queries to update the data pertaining to old categories.

Please follow the below steps to execute the queries:

  1. Navigate to OpenSearch service
  2. Select the PaladinCloud OpenSearch domain.
  3. Copy th URL for Kibana.
  4. Please note that domain is accessible only inside of VPC.
  5. Open the Kibana URL
  6. Navigate to Dev Tools and execute the following queries:
    POST assetgroup_stats/compliance/_update_by_query
    {
    "query": { 
    "bool": {
        "must_not": {
            "exists": {
                "field": "cost"
            }
        }
    }
    },
    "script" : {
    "inline": "ctx._source.cost = ctx._source.costOptimization; ctx._source.remove(\"costOptimization\");"
    }
    }
    POST assetgroup_stats/compliance/_update_by_query
    {
    "query": {
    "bool": {
      "must_not": {
        "exists": {
          "field": "operations"
        }
      }
    }
    },
    "script": {
    "inline": "ctx._source.operations = ctx._source.governance; ctx._source.remove(\"governance\");"
    }
    }
  7. This will update the existing trend data pertaining to old policy categories.
  8. Below Query to update the violations data:

    POST aws,gcp,azure/_update_by_query
    {
    "script": {
    "inline": "if(ctx._source.policyCategory!=null){ if(ctx._source.policyCategory=='costOptimization') {ctx._source['policyCategory'] = 'cost'} else if(ctx._source.policyCategory=='governance') {ctx._source['policyCategory'] = 'operations'}} ",
    "lang": "painless"
    },
    "query": {
    "bool":{
      "must":[
      {
        "terms":{
          "policyCategory.keyword": ["costOptimization","governance"]
        }
      },
      {
        "match":{
          "type": {
            "query":"issue"
          }
        }
    
      }]}
    }}

Please update the above indices with the clouds you are monitoring. For e.g., remove azure and gcp from the post request if you are monitoring only AWS.