# MongoDB Packetbeat - Multiple beats for same operation

**URL:** <https://discuss.elastic.co/t/mongodb-packetbeat-multiple-beats-for-same-operation/67375>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [November 28, 2016, 4:18pm UTC](https://discuss.elastic.co/t/mongodb-packetbeat-multiple-beats-for-same-operation/67375 "2016-11-28T16:18:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Kalkman](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@Peter\_Kalkman](https://discuss.elastic.co/u/Peter_Kalkman)\
**Post date:** [November 28, 2016, 4:18pm UTC](https://discuss.elastic.co/t/mongodb-packetbeat-multiple-beats-for-same-operation/67375/1 "2016-11-28T16:18:54Z")

</div>

Hi,

I've configured Packetbeat (5.0.1) to send MongoDB information via Logstash (5.0.1) to the current Cloud version of Elasticsearch (5.0.1).

It works great, but the thing is that I get multiple beats for the same MongoDB operation, which results in multiple documents in Elasticsearch.

See below for an example when at some point the query `test.users.find()` is executed in MongoDB, I get 2 (somes 3) beats.

Should I use some aggregation filter? Can somebody provide an example? Or should I deal with this in another way?

Thanks in advange!!

_Beat documents for single `users.find()` operation_

```auto
[
  {
    "_index": "sbm",
    "_type": "mongodb",
    "_id": "AVirqf5tsEe0TVUiaO7i",
    "_score": null,
    "_source": {
      "server": "",
      "proc": "",
      "method": "find",
      "bytes_in": 355,
      "resource": "test.users",
      "query": "test.users.find()",
      "ip": "xxx.xx.x.xxx",
      "type": "mongodb",
      "client_proc": "",
      "tags": [
        "beats_input_raw_event"
      ],
      "client_server": "",
      "client_port": 36630,
      "@timestamp": "2016-11-28T15:59:52.332Z",
      "bytes_out": 540,
      "port": 27000,
      "beat": {
        "hostname": "mongo-dev-0",
        "name": "mongo-dev-0",
        "version": "5.0.1"
      },
      "@version": "1",
      "host": "mongo-dev-0",
      "responsetime": 0,
      "client_ip": "yyy.yy.yy.yy",
      "mongodb": {
        "fullCollectionName": "test.$cmd",
        "numberReturned": 1,
        "numberToSkip": 0,
        "startingFrom": 0,
        "numberToReturn": 4294967295,
        "cursorId": 0
      },
      "status": "OK",
      "direction": "in"
    },
    "fields": {
      "@timestamp": [
        1480348792332
      ]
    },
    "sort": [
      1480348792332
    ]
  },
  {
    "_index": "sbm",
    "_type": "mongodb",
    "_id": "AVirqf5tsEe0TVUiaO7g",
    "_score": null,
    "_source": {
      "server": "",
      "proc": "",
      "method": "find",
      "resource": "test.users",
      "bytes_in": 346,
      "ip": "xxx.xx.x.xxx",
      "query": "test.users.find()",
      "type": "mongodb",
      "client_proc": "",
      "tags": [
        "beats_input_raw_event"
      ],
      "client_server": "",
      "client_port": 36634,
      "@timestamp": "2016-11-28T15:59:52.332Z",
      "bytes_out": 540,
      "port": 27000,
      "beat": {
        "hostname": "mongo-dev-0",
        "name": "mongo-dev-0",
        "version": "5.0.1"
      },
      "@version": "1",
      "host": "mongo-dev-0",
      "responsetime": 0,
      "client_ip": "yyy.yy.yy.yy",
      "mongodb": {
        "fullCollectionName": "test.$cmd",
        "numberReturned": 1,
        "numberToSkip": 0,
        "startingFrom": 0,
        "cursorId": 0,
        "numberToReturn": 4294967295
      },
      "status": "OK",
      "direction": "in"
    },
    "fields": {
      "@timestamp": [
        1480348792332
      ]
    },
    "sort": [
      1480348792332
    ]
  },
  {
    "_index": "sbm",
    "_type": "mongodb",
    "_id": "AVirqf5tsEe0TVUiaO7f",
    "_score": null,
    "_source": {
      "server": "",
      "proc": "",
      "method": "find",
      "bytes_in": 330,
      "resource": "test.users",
      "query": "test.users.find()",
      "ip": "xxx.xx.x.xxx",
      "type": "mongodb",
      "client_proc": "",
      "tags": [
        "beats_input_raw_event"
      ],
      "client_port": 36636,
      "client_server": "",
      "@timestamp": "2016-11-28T15:59:52.324Z",
      "bytes_out": 560,
      "port": 27000,
      "beat": {
        "hostname": "mongo-dev-0",
        "name": "mongo-dev-0",
        "version": "5.0.1"
      },
      "@version": "1",
      "host": "mongo-dev-0",
      "responsetime": 0,
      "client_ip": "yyy.yy.yy.yy",
      "mongodb": {
        "fullCollectionName": "test.$cmd",
        "numberReturned": 1,
        "numberToSkip": 0,
        "startingFrom": 0,
        "cursorId": 0,
        "numberToReturn": 4294967295
      },
      "status": "OK",
      "direction": "in"
    },
    "fields": {
      "@timestamp": [
        1480348792324
      ]
    },
    "sort": [
      1480348792324
    ]
  }
]

```

---

<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 29, 2016, 8:26pm UTC](https://discuss.elastic.co/t/mongodb-packetbeat-multiple-beats-for-same-operation/67375/2 "2016-11-29T20:26:00Z")

</div>

It looks like these are not identical but different events. For example bytes\_in is different in all 3. So if there are 3 packages for the request, you will get 3 events.

---

<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:** [December 27, 2016, 8:26pm UTC](https://discuss.elastic.co/t/mongodb-packetbeat-multiple-beats-for-same-operation/67375/3 "2016-12-27T20:26:21Z")

</div>

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