# New Logstash Grok add\_field

**URL:** https://discuss.elastic.co/t/new-logstash-grok-add-field/320659
**Category:** Elasticsearch
**Created:** [December 7, 2022, 8:13am UTC](https://discuss.elastic.co/t/new-logstash-grok-add-field/320659 "2022-12-07T08:13:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![anon74213320](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@anon74213320](https://discuss.elastic.co/u/anon74213320)
#### Post date: [December 7, 2022, 8:13am UTC](https://discuss.elastic.co/t/new-logstash-grok-add-field/320659/1 "2022-12-07T08:13:57Z")

</div>

Hi everyone

I am trying to add a new field for pick up a hostname from a logfile like this format:

```auto
Source : \\abc123

```

I tried with setting patterns file and add\_filed in grok and mutate but it is not added, it seems is not able to be referenced from pattern file.

I would need at the end to have a new field called "source" with value "abc123" displaying that value in kibana dashboard for searching records.

Thanks

---

<div class="post-metadata">

### Author: ![Venkata\_Raja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkata_raja/32/114264_2.png) [@Venkata\_Raja](https://discuss.elastic.co/u/Venkata_Raja)
#### Post date: [December 7, 2022, 2:58pm UTC](https://discuss.elastic.co/t/new-logstash-grok-add-field/320659/2 "2022-12-07T14:58:13Z")

</div>

Hi,

You can use [Set processor | Elasticsearch Guide [8.5] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.5/set-processor.html) processor for that.

---

<div class="post-metadata">

### Author: ![anon74213320](https://avatars.discourse-cdn.com/v4/letter/a/d78d45/32.png) [@anon74213320](https://discuss.elastic.co/u/anon74213320)
#### Post date: [December 7, 2022, 3:14pm UTC](https://discuss.elastic.co/t/new-logstash-grok-add-field/320659/3 "2022-12-07T15:14:14Z")

</div>

Hi

thank you for your reply.

The hostname value should be dynamc, the new field should be able to set it for each different logfile contain this record.  
Can I achieve this with the processor? if yes could you please write a small example, I m afraid it s not suitable for my case...

Thanks

---

<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 4, 2023, 3:14pm UTC](https://discuss.elastic.co/t/new-logstash-grok-add-field/320659/4 "2023-01-04T15:14:42Z")

</div>

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