JSON Logstash

I have a problem when taking the data from my json

suppose i need to take the data from this json

{
  "header" : {
    "sendingApplicationNs" : "value",
    "sendingApplicationId" : "value",
    "sendingApplicationIdType" : "value",
    "sendingFacilityNs" : "value",
    "sendingFacilityId" : "value",
    "receivingApplicationNs" : "value",
    "receivingApplicationId" : "value",
    "receivingApplicationIdType" : "value",
    "receivingFacilityNs" : "value",
    "receivingFacilityId" : "value",
    "messageType" : "value",
    "triggerEvent" : "value",
    "messageStructure" : "value"
  }

the json that I am treating but it is much longer but I am going to use these fields as an example

input {
  tcp {
    port => 5041
  }
}

filter {
  json {
    source => "message"
    target => "json_fields"
    remove_field => ["message"]
  }

  mutate {
    add_field => {
      "sendingApplicationNs" => "%{[json_fields][header][sendingApplicationNs]}"
      "sendingApplicationId" => "%{[json_fields][header][sendingApplicationId]}"
      "sendingApplicationIdType" => "%{[json_fields][header][sendingApplicationIdType]}"
      "sendingFacilityNs" => "%{[json_fields][header][sendingFacilityNs]}"
    }
  }
}


output {

  elasticsearch {
    hosts => ["http://<ip>:9200"]
        user => elastic
    password => XXXXX
    index => "mirth"
  }
}

I need to be able to see my "mirth" index in the discover panel and that the files that I am mentioning are found in it and that they bring me the value that is in the json

sendingApplicationNs = value

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.