# Automatically pushing PostgreSQL DB Server data to ES for indexing

**URL:** <https://discuss.elastic.co/t/automatically-pushing-postgresql-db-server-data-to-es-for-indexing/157397>\
**Category:** Elasticsearch\
**Created:** [November 19, 2018, 4:31pm UTC](https://discuss.elastic.co/t/automatically-pushing-postgresql-db-server-data-to-es-for-indexing/157397 "2018-11-19T16:31:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaushalshriyan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kaushalshriyan/32/44563_2.png) [@kaushalshriyan](https://discuss.elastic.co/u/kaushalshriyan)\
**Post date:** [November 19, 2018, 4:31pm UTC](https://discuss.elastic.co/t/automatically-pushing-postgresql-db-server-data-to-es-for-indexing/157397/1 "2018-11-19T16:31:07Z")

</div>

Hi,

I am running PostgreSQL DB server( version 9.6.11) and pushing it to ES (version 6.5.0) for indexing. I usually run /usr/share/logstash/bin/logstash -f products-index-logstash.conf manually. Is there a way to automate it meaning whenever the PostgreSQL database is updated the indexing is updated in ES or do i need to invoke /usr/share/logstash/bin/logstash -f products-index-logstash.conf via cron scheduler in Linux server?

> # file: products-index-logstash.conf
> 
> input {  
> jdbc {  
> # Postgres jdbc connection string to our database, mydb  
> jdbc\_connection\_string =\> "jdbc:postgresql://localhost:5432/elktest?user=postgres"  
> # The user we wish to execute our statement as  
> jdbc\_user =\> "postgres"  
> jdbc\_validate\_connection =\> true  
> # The path to our downloaded jdbc driver  
> jdbc\_driver\_library =\> "/etc/logstash/postgresql-42.2.5.jar"  
> # The name of the driver class for Postgresql  
> jdbc\_driver\_class =\> "org.postgresql.Driver"  
> # our query  
> statement =\> "SELECT \* from products"  
> }  
> }  
> output {  
> elasticsearch {  
> index =\> "elktest"  
> document\_id =\> "%{product\_no}"  
> }  
> }

Please suggest. Thanks in Advance.

Best Regards,

Kaushal

---

<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 17, 2018, 4:45pm UTC](https://discuss.elastic.co/t/automatically-pushing-postgresql-db-server-data-to-es-for-indexing/157397/2 "2018-12-17T16:45:12Z")

</div>

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