# Extract fields from a log path in logstash

**URL:** <https://discuss.elastic.co/t/extract-fields-from-a-log-path-in-logstash/136754>\
**Category:** Logstash\
**Created:** [June 20, 2018, 7:37pm UTC](https://discuss.elastic.co/t/extract-fields-from-a-log-path-in-logstash/136754 "2018-06-20T19:37:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aysala](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@aysala](https://discuss.elastic.co/u/aysala)\
**Post date:** [June 20, 2018, 7:37pm UTC](https://discuss.elastic.co/t/extract-fields-from-a-log-path-in-logstash/136754/1 "2018-06-20T19:37:24Z")

</div>

Hi experts,

I am trying to figure out a way to create new fields from a log path. Is there a way to configure this using processors in filebeat? or can anyone help me with the grok pattern that creates the below fields?

For example:

```
    filebeat.prospectors:
    - type: log    
      paths:
      - /var/lib/mesos/slave/slaves/some_slave_id/frameworks/some_framework_id/executors/some_executor_id/runs/latest/stdout

```

I want new fields that shows some\_slave\_id, some\_framework\_id and some\_executor\_id values.

Thanks!

---

<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:** [June 20, 2018, 8:09pm UTC](https://discuss.elastic.co/t/extract-fields-from-a-log-path-in-logstash/136754/2 "2018-06-20T20:09:58Z")

</div>

> [@aysala](#):
>
> /var/lib/mesos/slave/slaves/some\_slave\_id/frameworks/some\_framework\_id/executors/some\_executor\_id/runs/latest/stdout

If filebeat puts the path into the source field then you could use

```
dissect { mapping => { "source"=> '%{}/slaves/%{slave_id}/frameworks/%{framework_id}/executors/%{executor_id}/%{}' } }

```

---

<div class="post-metadata">

**Author:** ![aysala](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@aysala](https://discuss.elastic.co/u/aysala)\
**Post date:** [June 21, 2018, 1:56pm UTC](https://discuss.elastic.co/t/extract-fields-from-a-log-path-in-logstash/136754/3 "2018-06-21T13:56:44Z")

</div>

Works for me! Thanks @Badger 🙂

---

<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:** [July 19, 2018, 1:56pm UTC](https://discuss.elastic.co/t/extract-fields-from-a-log-path-in-logstash/136754/4 "2018-07-19T13:56:45Z")

</div>

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