# New protocol: CouchDB

**URL:** <https://discuss.elastic.co/t/new-protocol-couchdb/35538>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [November 25, 2015, 11:05am UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538 "2015-11-25T11:05:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keylor42](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Keylor42](https://discuss.elastic.co/u/Keylor42)\
**Post date:** [November 25, 2015, 11:05am UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/1 "2015-11-25T11:05:03Z")

</div>

Hello everyone,

While waiting for the [contributing agreement](https://discuss.elastic.co/t/new-protocol-amqp-0-9-1/27272/12?u=keylor42) for my AMQP plugin, my company asked me if it's possible to implement the couchdb protocol for Packetbeat. So I have two questions :

-First, is anybody already working on this protocol implementation ?

-Second, the couchdb protocol goes through the port 5984 and uses the http protocol with a REST api to receive requests. Would it be ok then to use some parts of the http protocol code to parse some parts of the requests (for example, headers), and from there parse what is interesting for the couchdb protocol (ex : database, document version etc.) ?

Thanks for your answer.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [November 25, 2015, 11:53am UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/2 "2015-11-25T11:53:04Z")

</div>

As far as I know, there is currently no one working on the CouchDB implementation. The best is in case you start to work on a protocol is to add an issue here and mention that you work on it: [https://github.com/elastic/packetbeat/labels/new%20protocol](https://github.com/elastic/packetbeat/labels/new%20protocol)

For your second question: Code reuse is always a good thing. So I don't see currently a good reason not to reuse the HTTP code.

---

<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:** [November 25, 2015, 12:07pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/3 "2015-11-25T12:07:56Z")

</div>

Awesome, someone asking about some application "protocol" on top of http.

Haven't had time to start this yet, but the idea was basically to use some criteria like ports and/or http content-type to further analyze the HTTP body. I'm not aware of CouchDB protocols in use, but as I understand it uses a JSON based REST API, right? So if we add a feature to parse(and merge into final event) the JSON body (content-type == application/json), we will be able to support some more services but CouchDB. For example Elasticsearch HTTP API. Think using packetbeat to analyze Logstash/Kibana \<-\> Elasticsearch . Also monitoring Rich-Client Web applications using REST+JSON will benefit from this enhancement.

For starters I've been thinking about supporting JSON and XML based content-type.

---

<div class="post-metadata">

**Author:** ![darren\_m](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@darren\_m](https://discuss.elastic.co/u/darren_m)\
**Post date:** [November 25, 2015, 4:21pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/4 "2015-11-25T16:21:09Z")

</div>

This approach of building on top of HTTP would be useful for the AVRO support I'm working on. One of the options for AVRO communication is to POST the binary over HTTP, the body having content-type = 'binary/avro'.  
Obviously that's less generic than JSON and XML, but I think the solution would be similar.

---

<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:** [November 25, 2015, 5:19pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/5 "2015-11-25T17:19:41Z")

</div>

well, the idea is to have it kinda 'pluggable' (think HTTP content extensions), just like the protocol analyzers are already kind of plugins. Sounds like AVRO is another use-case.

---

<div class="post-metadata">

**Author:** ![Keylor42](https://avatars.discourse-cdn.com/v4/letter/k/96bed5/32.png) [@Keylor42](https://discuss.elastic.co/u/Keylor42)\
**Post date:** [November 26, 2015, 8:54am UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/6 "2015-11-26T08:54:50Z")

</div>

You mean a kind of Parse interface for RESTful apis in http ? That would be a good idea. Allowing the user to directly have the url, informations like content-type, and the body would help to parse a lot of protocols like ElasticSearch and CouchDB.

---

<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:** [November 26, 2015, 2:21pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/7 "2015-11-26T14:21:18Z")

</div>

@Keylor42 Yep, this is what I've been thinking about.

---

<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:** [November 26, 2015, 2:38pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/8 "2015-11-26T14:38:06Z")

</div>

These tickets seem to be kinda related:

- [https://github.com/elastic/packetbeat/issues/179](https://github.com/elastic/packetbeat/issues/179)
- [https://github.com/elastic/packetbeat/issues/44](https://github.com/elastic/packetbeat/issues/44)

New ticket: [https://github.com/elastic/packetbeat/issues/404](https://github.com/elastic/packetbeat/issues/404)

---

<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:** [November 27, 2015, 4:36pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/9 "2015-11-27T16:36:51Z")

</div>

Added some proposal to [https://github.com/elastic/packetbeat/issues/404](https://github.com/elastic/packetbeat/issues/404). Feel free to comment or subsribe to github issue.

---

<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:** [July 5, 2017, 9:57pm UTC](https://discuss.elastic.co/t/new-protocol-couchdb/35538/10 "2017-07-05T21:57:55Z")

</div>


