# How do I write a processor plugin by myself?

**URL:** <https://discuss.elastic.co/t/how-do-i-write-a-processor-plugin-by-myself/126719>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [April 4, 2018, 10:33am UTC](https://discuss.elastic.co/t/how-do-i-write-a-processor-plugin-by-myself/126719 "2018-04-04T10:33:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ma\_wen](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@ma\_wen](https://discuss.elastic.co/u/ma_wen)\
**Post date:** [April 4, 2018, 10:33am UTC](https://discuss.elastic.co/t/how-do-i-write-a-processor-plugin-by-myself/126719/1 "2018-04-04T10:33:06Z")

</div>

How do I write a processor plugin by myself?

---

<div class="post-metadata">

**Author:** ![kvch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kvch/32/72058_2.png) [@kvch](https://discuss.elastic.co/u/kvch)\
**Post date:** [April 4, 2018, 10:58am UTC](https://discuss.elastic.co/t/how-do-i-write-a-processor-plugin-by-myself/126719/2 "2018-04-04T10:58:05Z")

</div>

New processors must be added to `libbeat/processors`. A processor has to register itself in the `init` function. It also needs to implement `Run` which does the transformation of the event. An additional `String` function is required which is used during logging.  
A simple example can be found here: [https://github.com/elastic/beats/blob/master/libbeat/processors/add\_host\_metadata/add\_host\_metadata.go](https://github.com/elastic/beats/blob/master/libbeat/processors/add_host_metadata/add_host_metadata.go)

---

<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:** [May 2, 2018, 10:58am UTC](https://discuss.elastic.co/t/how-do-i-write-a-processor-plugin-by-myself/126719/3 "2018-05-02T10:58:09Z")

</div>

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