# Ingest Json data into Elastic Search using filebeat

**URL:** <https://discuss.elastic.co/t/ingest-json-data-into-elastic-search-using-filebeat/293510>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 5, 2022, 8:57am UTC](https://discuss.elastic.co/t/ingest-json-data-into-elastic-search-using-filebeat/293510 "2022-01-05T08:57:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Magesh\_02](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magesh_02/32/94023_2.png) [@Magesh\_02](https://discuss.elastic.co/u/Magesh_02)\
**Post date:** [January 5, 2022, 8:57am UTC](https://discuss.elastic.co/t/ingest-json-data-into-elastic-search-using-filebeat/293510/1 "2022-01-05T08:57:19Z")

</div>

I attempted to import data from a json file into Elasticsearch, but my filebeat had a configuration issue in filebeat.yml or an issue with the input Because my json is regular json, but filebeat only supports ndjson,

Filebeat.yml

```auto
    filebeat.inputs:
    - type: log
      enabled: true
      paths:
      - Metrics.json
      multiline.pattern: '^{'
      multiline.negate: true
      multiline.match: after
    
    processors:
    - decode_json_fields:
       fields: ["message"]
       process_array: false
       max_depth: 2
       target: Json
       overwrite_keys: true
       add_error_key: false
      
    
    output.elasticsearch:
      hosts: ["localhost:9200"]

```

**Json Input**

```auto
   {
      "Sourcedata": [
        {
          "Language": " C",
          "Code": 106026
        },
        {
          "Language": " C++",
          "Code": 52166
        }
      ]
    }

```

1. How to convert JSon to ndjson?
2. What problem with my filebeat configuration?

---

<div class="post-metadata">

**Author:** ![legoguy1000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/legoguy1000/32/54301_2.png) [@legoguy1000](https://discuss.elastic.co/u/legoguy1000)\
**Post date:** [January 26, 2022, 3:06am UTC](https://discuss.elastic.co/t/ingest-json-data-into-elastic-search-using-filebeat/293510/2 "2022-01-26T03:06:57Z")

</div>

U could try using the [Gsub processor | Elasticsearch Guide [7.16] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/gsub-processor.html) processor prior to decoding to remove the new line characters

---

<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:** [February 23, 2022, 5:07am UTC](https://discuss.elastic.co/t/ingest-json-data-into-elastic-search-using-filebeat/293510/3 "2022-02-23T05:07:47Z")

</div>

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