# PacketBeat: unable to compile tcp example

**URL:** <https://discuss.elastic.co/t/packetbeat-unable-to-compile-tcp-example/97690>\
**Category:** Beats\
**Created:** [August 20, 2017, 2:43pm UTC](https://discuss.elastic.co/t/packetbeat-unable-to-compile-tcp-example/97690 "2017-08-20T14:43:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![firmitas](https://avatars.discourse-cdn.com/v4/letter/f/bcef8e/32.png) [@firmitas](https://discuss.elastic.co/u/firmitas)\
**Post date:** [August 20, 2017, 2:43pm UTC](https://discuss.elastic.co/t/packetbeat-unable-to-compile-tcp-example/97690/1 "2017-08-20T14:43:31Z")

</div>

Hi,  
I'm trying to write my own packetbeat, so I'm generating a tcp protocol base on "create\_tcp\_protocol.py".  
And when I'm trying to compile the new packetbeat I get the next error:  
**protos/mybeat/pub.go:15: undefined: publish.Transactions**  
It seaams like there is some code missing.  
Can someone help me.

---

<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:** [August 20, 2017, 7:32pm UTC](https://discuss.elastic.co/t/packetbeat-unable-to-compile-tcp-example/97690/2 "2017-08-20T19:32:07Z")

</div>

Which branch are you using? The beats publisher pipeline in the master and 6.0 branch has been updated. Some minor tasks (like updating the packetbeat code generator) are still on the todo/cleanup list. Switching to the most recent stable release branch (5.5 or upcoming 5.6) should resolve the issue.

The difference is with packetbeat modules publishing an event of type `beat.Event`. For example see [pub.go in the cassandra protocol plugin](https://github.com/elastic/beats/blob/master/packetbeat/protos/cassandra/pub.go#L35) (which was originally implemented using the tcp protocol generator).

The change is quite minor. Developing a module for 5.x and updating it later for use with 6.x/master does not take much effort. replace the event with [`beat.Event` type](https://github.com/elastic/beats/blob/master/libbeat/beat/event.go#L14) and instead of adding `@timestamp` to the event, set the `Timestamp` field in the event of type `beat.Event`. Plus replace `publisher.Transactions` with `protos.Reporter`.

The changes to the cassandra protocol plugin in [this PR](https://github.com/elastic/beats/pull/4599) pretty much summarise the required changes. See [cassandra.go](https://github.com/elastic/beats/pull/4599/files#diff-17cbf8702ff13b13ca776e7ddf295aff) for plugin initialization and [pub.go](https://github.com/elastic/beats/pull/4599/files#diff-50866a400db644c56e8049d5fd1fbf21) for event publishing changes.

Sorry for any inconveniences. I will fix the code generator tomorrow.

---

<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:** [August 20, 2017, 7:56pm UTC](https://discuss.elastic.co/t/packetbeat-unable-to-compile-tcp-example/97690/3 "2017-08-20T19:56:43Z")

</div>

See [PR #4956](https://github.com/elastic/beats/pull/4956).

---

<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:** [September 10, 2017, 2:43pm UTC](https://discuss.elastic.co/t/packetbeat-unable-to-compile-tcp-example/97690/4 "2017-09-10T14:43:47Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
