# How to set custom fileds via CLI when ingesting with filebeat?

**URL:** <https://discuss.elastic.co/t/how-to-set-custom-fileds-via-cli-when-ingesting-with-filebeat/167892>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [February 11, 2019, 4:03pm UTC](https://discuss.elastic.co/t/how-to-set-custom-fileds-via-cli-when-ingesting-with-filebeat/167892 "2019-02-11T16:03:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![holgerbrandl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/holgerbrandl/32/40800_2.png) [@holgerbrandl](https://discuss.elastic.co/u/holgerbrandl)\
**Post date:** [February 11, 2019, 4:03pm UTC](https://discuss.elastic.co/t/how-to-set-custom-fileds-via-cli-when-ingesting-with-filebeat/167892/1 "2019-02-11T16:03:52Z")

</div>

Hi there,

when running filebeat I'd like to set some custom fields and tags via a CLI parameter.  
zcat mylog.gz | filebeat -e config yml -E "tags=['huhu']" -E "fields.app\_id=['foo']"

The corresponing bits in config are

filebeat.inputs:  
filebeat.inputs:

- type: stdin  
enabled: true  
ignore\_older: 0  
tags: ["dummy"]  
fields:  
app\_id: query\_engine\_12

However, in elastic just the tags are set, but the field is not. Why is that?

Related to that: the docs [https://www.elastic.co/guide/en/beats/filebeat/current/command-line-options.html](https://www.elastic.co/guide/en/beats/filebeat/current/command-line-options.html) seem to indicate that I would need to write -E "filebeat.inputs.tags=['huhu']" instead? Why does it work as described above but not when using the full field reference?

Thanks in advance,  
Holger

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [February 12, 2019, 3:09am UTC](https://discuss.elastic.co/t/how-to-set-custom-fileds-via-cli-when-ingesting-with-filebeat/167892/2 "2019-02-12T03:09:47Z")

</div>

I'm unable to reproduce this issue with Filebeat I just built from source (from the `master` branch). What version of Filebeat are you running?

---

<div class="post-metadata">

**Author:** ![holgerbrandl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/holgerbrandl/32/40800_2.png) [@holgerbrandl](https://discuss.elastic.co/u/holgerbrandl)\
**Post date:** [February 12, 2019, 7:44am UTC](https://discuss.elastic.co/t/how-to-set-custom-fileds-via-cli-when-ingesting-with-filebeat/167892/3 "2019-02-12T07:44:16Z")

</div>

Hey Shaunak,

I'm using the binary release 6.6. What would certainly help is to see some more example that overwrite parameters defined in a filebeat yaml. For instance I'm not even sure if should use -E or -M.

Are you saying that it should work as described above? What would be the correct syntax to set custom field attributes for the filebeat log module via the CLI?

Thanks a lot for your support.

Best,  
Holger

---

<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:** [March 12, 2019, 7:44am UTC](https://discuss.elastic.co/t/how-to-set-custom-fileds-via-cli-when-ingesting-with-filebeat/167892/4 "2019-03-12T07:44:19Z")

</div>

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