Home > Mobile >  how to skip particular fields from inserting in elasticsearch? Don't want to fields like "
how to skip particular fields from inserting in elasticsearch? Don't want to fields like "

Time:11-29

In the record, I am not inserting fields like "message", "event", or "log". These fields are autogenerated while inserting records from CSV file using logstash somehow which I would like not to get there.

The record in the index looks like follows:

        "_index": "jmeter2",
        "_id": "dsfdsfdsf",
        "_score": 1,
        "_source": {
          "Samples": "1083",
          "Received KB/sec": "178.9",
          "99th pct": "1350",
          "log": {
            "file": {
              "path": "/Users/abc/Downloads/opt/jenkins/workspace/agg_report2.csv"
            }
          },
          "host": {
            "name": "dfdsfdsffs"
          },
          "@timestamp": "2022-11-22T07:15:29.052181Z",
          "95th pct": "659",
          "Min": "112",
          "Max": "3829",
          "@version": "1",
          "Throughput": "7.2",
          "Label": "ACTIVITY_DETAIL",
          "90th pct": "338",
          "Build_number": "abcd1111",
          "Error %": "0.00%",
          "Median": "207",
          "message": "ACTIVITY_DETAIL,1083,270,207,338,659,1350,112,3829,0.00%,7.2,178.9,251.61",
          "event": {
            "original": "ACTIVITY_DETAIL,1083,270,207,338,659,1350,112,3829,0.00%,7.2,178.9,251.61"
          },
          "Average Response Time": "270",
          "Stddev": "251.61"
      }
}

CodePudding user response:

You can add a remove_field statement to your csv filter :

    filter {
      csv {
        remove_field => [ "message", "event", "log" ]
      }
    }

https://www.elastic.co/guide/en/logstash/current/plugins-filters-mutate.html#plugins-filters-mutate-remove_field

  • Related