# Testing custom plugin to Packetbeat

**URL:** <https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [January 5, 2017, 12:33pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677 "2017-01-05T12:33:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumit419](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sumit419](https://discuss.elastic.co/u/sumit419)\
**Post date:** [January 5, 2017, 12:33pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/1 "2017-01-05T12:33:04Z")

</div>

Hi I have written a plugin for a TCP application the packets contain plain TCP data. I want to integrate with the packetbeat and use it in debug mode. To see if the new plugin is doing. I'm new to packetbeat.

Thanks.

---

<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 5, 2017, 2:01pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/2 "2017-01-05T14:01:36Z")

</div>

filebeat or packetbeat?

have you had a look at packetbeat system tests: [https://github.com/elastic/beats/tree/master/packetbeat/tests/system](https://github.com/elastic/beats/tree/master/packetbeat/tests/system)

These tests use packetbeat to process pcap files and validate the generated events.

---

<div class="post-metadata">

**Author:** ![sumit419](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sumit419](https://discuss.elastic.co/u/sumit419)\
**Post date:** [January 5, 2017, 4:28pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/3 "2017-01-05T16:28:34Z")

</div>

packetbeat. will have a look at it. thanks

---

<div class="post-metadata">

**Author:** ![sumit419](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sumit419](https://discuss.elastic.co/u/sumit419)\
**Post date:** [January 7, 2017, 8:19pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/4 "2017-01-07T20:19:16Z")

</div>

@steffens  
I'm able to register my plugin with packetbeat now. The protocol is being registered and is also parsing the packets for that protocol but it is not publishing the event. Any idea why??

---

<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 8, 2017, 5:33pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/5 "2017-01-08T17:33:46Z")

</div>

Have you configured the port number correctly?

Have you tried to run packetbeat with `-d '*'`? This will enable debug logs. Add a debug statement when a packet is parsed and check packets are correctly forwarded to your plugin.

---

<div class="post-metadata">

**Author:** ![sumit419](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sumit419](https://discuss.elastic.co/u/sumit419)\
**Post date:** [January 9, 2017, 6:51am UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/6 "2017-01-09T06:51:55Z")

</div>

Yes I have configured the port. The packet data is being parsed and the tcp flow event is being published but the protocol events(from custom publisher) are not being published.

---

<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 9, 2017, 7:04pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/7 "2017-01-09T19:04:33Z")

</div>

well, time to debug your protocol analyzer.

As I already noted, add a debug statement to your `Parse` method in order to check a packet is actually parsed.

If you run with `-d '*'` you will see all published events on console. If your events are missing, it's time to debug your code actually working correctly. Add some more debug statements before/after parsing, before/after message correlation, before/after generating an event and so on.

Have you used the code generator? [https://github.com/elastic/beats/tree/master/generate/packetbeat/tcp-protocol](https://github.com/elastic/beats/tree/master/generate/packetbeat/tcp-protocol)

---

<div class="post-metadata">

**Author:** ![sumit419](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@sumit419](https://discuss.elastic.co/u/sumit419)\
**Post date:** [January 16, 2017, 8:55am UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/8 "2017-01-16T08:55:07Z")

</div>

@steffens thanks. I tested the plugin, it works 🙂

---

<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 16, 2017, 4:09pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/9 "2017-01-16T16:09:04Z")

</div>

Cool!

---

<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 13, 2017, 4:09pm UTC](https://discuss.elastic.co/t/testing-custom-plugin-to-packetbeat/70677/10 "2017-02-13T16:09:26Z")

</div>

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