# Loading a json file to enrich data

**URL:** <https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683>\
**Category:** Logstash\
**Created:** [April 30, 2025, 4:48pm UTC](https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683 "2025-04-30T16:48:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francesco\_Esposito](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francesco_esposito/32/141865_2.png) [@Francesco\_Esposito](https://discuss.elastic.co/u/Francesco_Esposito)\
**Post date:** [April 30, 2025, 4:48pm UTC](https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683/1 "2025-04-30T16:48:52Z")

</div>

Hello everyone,

I am working with Logstash UDP Input Plugin and Elasticsearch output plugin.

I need to load a json file containing information that I need to enrich the data sent to elastic matching same criteria.

What's the way to read a json file to load this data in memory?

I already use jdbc\_static for enriching some data and I need also data coming from a json file.

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [April 30, 2025, 8:31pm UTC](https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683/2 "2025-04-30T20:31:25Z")

</div>

If source/input is only UDP, you use the [json](https://www.elastic.co/docs/reference/logstash/plugins/plugins-codecs-json) codec or Json\_lines for the multiline. In case of file on the disk, you should use the file input plugin.

If json is inside fields, you have to parse, and the most likely you will need the [json](https://www.elastic.co/docs/reference/logstash/plugins/plugins-filters-json) filter.  
Not sure how you will get it, like a single JSON in the message or multiline.

---

<div class="post-metadata">

**Author:** ![Francesco\_Esposito](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/francesco_esposito/32/141865_2.png) [@Francesco\_Esposito](https://discuss.elastic.co/u/Francesco_Esposito)\
**Post date:** [April 30, 2025, 9:08pm UTC](https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683/3 "2025-04-30T21:08:53Z")

</div>

Mmm, @Rios , I don't need to load the json data contained in the json file (yes, it's just one file and it's on the disk) as an event itself, I need to use that data for "enriching" my UDP received event, as we do with jdbc\_static.

The file contains a list of KEY / VALUE that will be used to enrich the UDP received data.

What's the way to read a json file at the pipeline ingestion start and have this data in memory?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [April 30, 2025, 9:18pm UTC](https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683/4 "2025-04-30T21:18:08Z")

</div>

You might be able to use a [translate](https://www.elastic.co/docs/reference/logstash/plugins/plugins-filters-translate) filter to do a lookup.

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [April 30, 2025, 9:21pm UTC](https://discuss.elastic.co/t/loading-a-json-file-to-enrich-data/377683/5 "2025-04-30T21:21:44Z")

</div>

I don't know how the message looks in the filter, key/value then might use KV filter, might, not sure.  
Take into account, also Budger advice.
