# LOGSTASH: How to setup logstash to get all query's data not only a part of it?

**URL:** <https://discuss.elastic.co/t/logstash-how-to-setup-logstash-to-get-all-querys-data-not-only-a-part-of-it/251507>\
**Category:** Logstash\
**Created:** [October 8, 2020, 9:56pm UTC](https://discuss.elastic.co/t/logstash-how-to-setup-logstash-to-get-all-querys-data-not-only-a-part-of-it/251507 "2020-10-08T21:56:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![I\_Hathout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/i_hathout/32/76915_2.png) [@I\_Hathout](https://discuss.elastic.co/u/I_Hathout)\
**Post date:** [October 8, 2020, 9:56pm UTC](https://discuss.elastic.co/t/logstash-how-to-setup-logstash-to-get-all-querys-data-not-only-a-part-of-it/251507/1 "2020-10-08T21:56:44Z")

</div>

I've a database table which contains 400+ records, but each time, I use logstash and JDBC it only gets 126 records. I tried many times with different indices each time, but still the 126 only retrieving.

Here is the output configurations:

```auto
input {
    jdbc {
        -
        -
        jdbc_driver_class => "org.postgresql.Driver"
        statement => "SELECT * from xfailure"
    }
}
output {
elasticsearch {
   hosts => ["localhost:9200"]
   manage_template => false
   index => "test_predictions"
   document_id => "%{id}"
}
}

```

When I check the number of rows, I found that it has 400+ records here is the select statment:

```auto
SELECT * FROM xfailure;

```

here is a sample of the record columns:

```auto
id|modified|x_url|x_id|correlation_id|links|code|description|explanation|tr_id

```

Whem I create an index on Kibanna, I used the timestamp as time field, but the number of hits is just 162 hits!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 8, 2020, 10:17pm UTC](https://discuss.elastic.co/t/logstash-how-to-setup-logstash-to-get-all-querys-data-not-only-a-part-of-it/251507/2 "2020-10-08T22:17:20Z")

</div>

> [@I\_Hathout](#):
>
> `document_id => "%{id}"`

If two records have the same value of id the second will overwrite the first. Can you do a SELECT COUNT (DISTINCT id) FROM xfailure?

---

<div class="post-metadata">

**Author:** ![I\_Hathout](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/i_hathout/32/76915_2.png) [@I\_Hathout](https://discuss.elastic.co/u/I_Hathout)\
**Post date:** [October 8, 2020, 10:29pm UTC](https://discuss.elastic.co/t/logstash-how-to-setup-logstash-to-get-all-querys-data-not-only-a-part-of-it/251507/3 "2020-10-08T22:29:03Z")

</div>

400+. the id field is unique in that postgres database table. @Badger

---

<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:** [November 5, 2020, 10:29pm UTC](https://discuss.elastic.co/t/logstash-how-to-setup-logstash-to-get-all-querys-data-not-only-a-part-of-it/251507/4 "2020-11-05T22:29:19Z")

</div>

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