# How to write processors?

**URL:** <https://discuss.elastic.co/t/how-to-write-processors/115458>\
**Category:** Beats\
**Tags:** beats-development\
**Created:** [January 14, 2018, 9:55pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458 "2018-01-14T21:55:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![benben](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benben/32/6660_2.png) [@benben](https://discuss.elastic.co/u/benben)\
**Post date:** [January 14, 2018, 9:55pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/1 "2018-01-14T21:55:33Z")

</div>

Hi,

I recently wrote a new beat for serial data, called [serialbeat](https://github.com/benben/serialbeat). Now I want to add a processor to this beat, which does a few things with the data before sending it somewhere. Is there any documentation on how to write a processor? If not, do you have any other resources or info you can give me for doing that?

Thank you!

---

<div class="post-metadata">

**Author:** ![exekias](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/exekias/32/28718_2.png) [@exekias](https://discuss.elastic.co/u/exekias)\
**Post date:** [January 15, 2018, 10:51am UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/2 "2018-01-15T10:51:14Z")

</div>

Hi @benben,

I don't think we have any documentation on that, perhaps you can get some inspiration from a simple one, like [add\_locale](https://github.com/elastic/beats/tree/master/libbeat/processors/add_locale). Don't forget to register it here: [https://github.com/elastic/beats/blob/7fbd75db9620eb102e790f0d32fee3a7765ae6d0/libbeat/cmd/instance/beat.go#L49](https://github.com/elastic/beats/blob/7fbd75db9620eb102e790f0d32fee3a7765ae6d0/libbeat/cmd/instance/beat.go#L49)

---

<div class="post-metadata">

**Author:** ![benben](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benben/32/6660_2.png) [@benben](https://discuss.elastic.co/u/benben)\
**Post date:** [January 15, 2018, 2:34pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/3 "2018-01-15T14:34:27Z")

</div>

Hi @exekias, thanks for the info. That should be enough for a start. Is there a way to have a processor only in the repository of a beat or do I need to fork and update the whole beats lib and then update my beat with this custom version. Thinking of something like a beat-scoped processor.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 15, 2018, 3:14pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/4 "2018-01-15T15:14:31Z")

</div>

You can register the plugin using the empty import in your own beats `main.go` file. No need to fork beats.

Given your processing is specialised, why you need to introduce a new processor type?

---

<div class="post-metadata">

**Author:** ![benben](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/benben/32/6660_2.png) [@benben](https://discuss.elastic.co/u/benben)\
**Post date:** [January 20, 2018, 7:43pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/5 "2018-01-20T19:43:57Z")

</div>

Thanks for you answer. I want to process serial data and send it directly to ES without having to run a logstash inbetween.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [January 22, 2018, 2:59pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/6 "2018-01-22T14:59:21Z")

</div>

Right. I just wonder why you need to introduce a configurable process, instead of having the data collector do the required processing.

---

<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:** [February 19, 2018, 2:59pm UTC](https://discuss.elastic.co/t/how-to-write-processors/115458/7 "2018-02-19T14:59:31Z")

</div>

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