# Packetbeat Adding Output Fields from YML config file

**URL:** <https://discuss.elastic.co/t/packetbeat-adding-output-fields-from-yml-config-file/319686>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [November 23, 2022, 9:57pm UTC](https://discuss.elastic.co/t/packetbeat-adding-output-fields-from-yml-config-file/319686 "2022-11-23T21:57:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbh1985](https://avatars.discourse-cdn.com/v4/letter/d/e56c9b/32.png) [@dbh1985](https://discuss.elastic.co/u/dbh1985)\
**Post date:** [November 23, 2022, 9:57pm UTC](https://discuss.elastic.co/t/packetbeat-adding-output-fields-from-yml-config-file/319686/1 "2022-11-23T21:57:12Z")

</div>

How can I configure the packetbeat yml file to add a field "username" if an output field exists "agent.hostname" equal to a specific value?

Here's what I got so far, but unable to start service afterwards:  
I've put this config under Processors, from what I've read on Elastic documentation.

- add\_fields:  
when:  
equals:  
agent.hostname: \*\*\*\*\*\*\*\*  
target: username  
fields:  
name: \*\*\*\*\*\*

---

<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:** [December 21, 2022, 11:57pm UTC](https://discuss.elastic.co/t/packetbeat-adding-output-fields-from-yml-config-file/319686/2 "2022-12-21T23:57:20Z")

</div>

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