# Enrich documents with another json file

**URL:** <https://discuss.elastic.co/t/enrich-documents-with-another-json-file/259004>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [December 17, 2020, 2:28pm UTC](https://discuss.elastic.co/t/enrich-documents-with-another-json-file/259004 "2020-12-17T14:28:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon42972578](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@anon42972578](https://discuss.elastic.co/u/anon42972578)\
**Post date:** [December 17, 2020, 2:28pm UTC](https://discuss.elastic.co/t/enrich-documents-with-another-json-file/259004/1 "2020-12-17T14:28:36Z")

</div>

Hello,

we have a server with logfiles in directories:

```
/xxx/log1/
- test-1.log
- test-2.log
- enrich-log1.json

/xxx/log2/
- test-1.log
- test-2.log
- enrich-log2.json

```

and so on....

the json file "enrich-log\*.json" has more details about the logs within the same directory and looks like this:  
`{"key-1":"value-1", "key-2":"value-2", "key-3":"value-3"}`

we configured filebeat:

```auto
    filebeat.inputs:
    -type:
         log.paths:
               /xxx/log*/*.log

```

How can we add the data from "enrich.json" as fields to every document within the same directory ?

this is something we look for (of course not working):

```auto
filebeat.inputs:
-type:
  log.paths:
      /xxx/log*/*.log
  processors:
      add_fields:
          target: enriched
          source: /xxx/log*/enrich-log*.json
          fields:
              key-1: "value1"
              key-2: "value2"
              key-3: "value3"

```

We already thought about using Logstash, but only Filebeat has access to the directories.

best regards

---

<div class="post-metadata">

**Author:** ![fadjar340](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fadjar340/32/43610_2.png) [@fadjar340](https://discuss.elastic.co/u/fadjar340)\
**Post date:** [December 24, 2020, 10:47am UTC](https://discuss.elastic.co/t/enrich-documents-with-another-json-file/259004/2 "2020-12-24T10:47:57Z")

</div>

Perhaps you need to understand how enrich processor works..

> **[Set up an enrich processor | Elasticsearch Reference \[7.10\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/enrich-setup.html)**

---

<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:** [January 21, 2021, 12:47pm UTC](https://discuss.elastic.co/t/enrich-documents-with-another-json-file/259004/3 "2021-01-21T12:47:58Z")

</div>

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