# Can metricbeat copy fields from basic fields like event or agent?

**URL:** <https://discuss.elastic.co/t/can-metricbeat-copy-fields-from-basic-fields-like-event-or-agent/242137>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [July 22, 2020, 5:53am UTC](https://discuss.elastic.co/t/can-metricbeat-copy-fields-from-basic-fields-like-event-or-agent/242137 "2020-07-22T05:53:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![CHU\_XU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chu_xu/32/45946_2.png) [@CHU\_XU](https://discuss.elastic.co/u/CHU_XU)\
**Post date:** [July 22, 2020, 5:53am UTC](https://discuss.elastic.co/t/can-metricbeat-copy-fields-from-basic-fields-like-event-or-agent/242137/1 "2020-07-22T05:53:46Z")

</div>

Hi experts,

I'd like to copy the host name to event root when using system module.

```
- copy_fields:
    fields:
      - from: agent.name
        to: name
    fail_on_error: true
    ignore_missing: false

```

Output is:

"ecs": {  
"version": "1.5.0"  
},  
"agent": {  
"ephemeral\_id": "xxx",  
"id": "xxx",  
"name": "xxx",  
"type": "metricbeat",  
"version": "7.8.0",  
"hostname": "xxx"  
},  
"system": ...

But I got the error msg saying "Failed to copy fields in copy\_fields processor: could not fetch value for key: agent.name, Error: key not found"

Any idea about it?

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:** [August 19, 2020, 7:53am UTC](https://discuss.elastic.co/t/can-metricbeat-copy-fields-from-basic-fields-like-event-or-agent/242137/2 "2020-08-19T07:53:51Z")

</div>

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