# JSON Logstash

**URL:** https://discuss.elastic.co/t/json-logstash/328403
**Category:** Logstash
**Created:** [March 24, 2023, 12:55am UTC](https://discuss.elastic.co/t/json-logstash/328403 "2023-03-24T00:55:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Whazaza](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@Whazaza](https://discuss.elastic.co/u/Whazaza)
#### Post date: [March 24, 2023, 12:55am UTC](https://discuss.elastic.co/t/json-logstash/328403/1 "2023-03-24T00:55:06Z")

</div>

I have a problem when taking the data from my json

suppose i need to take the data from this json

```auto
{
  "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

```auto
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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 21, 2023, 12:55am UTC](https://discuss.elastic.co/t/json-logstash/328403/2 "2023-04-21T00:55:44Z")

</div>

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