# Read Oracle Database Table Data vi Logstash to insert into ElasticSearch

**URL:** <https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717>\
**Category:** Logstash\
**Tags:** elastic-stack-monitoring\
**Created:** [January 23, 2023, 10:47am UTC](https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717 "2023-01-23T10:47:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SP003](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sp003/32/112159_2.png) [@SP003](https://discuss.elastic.co/u/SP003)\
**Post date:** [January 23, 2023, 10:47am UTC](https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717/1 "2023-01-23T10:47:15Z")

</div>

**Dear all,**

I am trying to connect with table from Oracle Database, and read records through logstash, and then to insert into Elastic search. And the same I want to do in a Linux system.

So far I understood that I have to configure logstash input plugin.

Could you please help me, how can I configure the same.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![sai\_saran1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sai_saran1/32/116661_2.png) [@sai\_saran1](https://discuss.elastic.co/u/sai_saran1)\
**Post date:** [January 23, 2023, 2:03pm UTC](https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717/2 "2023-01-23T14:03:52Z")

</div>

You can use JDBC input plugin for getting the data from oracle database.  
For that we have to provide path to JDBC driver, Connection string, User, Password, Schedule(Logstash will poll the DB based on the Cron), Statement(Query) etc., in the configuration.  
it looks something like this:

```auto
input {
  jdbc {
    jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar"
    jdbc_driver_class => "com.mysql.jdbc.Driver"
    jdbc_connection_string => "jdbc:mysql://localhost:3306/mydb"
    jdbc_user => "user"
    jdbc_password => "password"
    schedule => "* * * * *"
    statement => "SELECT * from songs where artist = :favorite_artist"
  }
}

```

refer the below for more inputs

> **[Jdbc input plugin | Logstash Reference \[8.6\] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-jdbc.html)**

---

<div class="post-metadata">

**Author:** ![SP003](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sp003/32/112159_2.png) [@SP003](https://discuss.elastic.co/u/SP003)\
**Post date:** [January 23, 2023, 3:16pm UTC](https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717/3 "2023-01-23T15:16:08Z")

</div>

Thank you @sai_saran1 !!

Its working fine 🙂

I created **logstash-ora.conf** file in /etc/logstash/conf.d/ directory.  
And placed required oracle connection string with credentials, and tried with a simple query , "select \* from DUAL". And its working perfectly fine.. 🙂  
You can see in the below screenshot, " **rawsearchdata**" index got created!!

```auto
		 input {
 			jdbc {
   				    jdbc_validate_connection => true
  			     	    jdbc_connection_string => "jdbc:oracle:thin:@192.168.1.2:1881/xe"
      				    jdbc_user => "user_details"
      				    jdbc_password => "user_password"
      				    jdbc_driver_library => "/usr/share/logstash/bin/ojdbc7.jar"
      				    jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
                        statement => "select * from DUAL"
  			       }
        }
 
output {
 elasticsearch {
   					hosts => ["http://localhost:9200"]
   					index => "rawsearchdata"
   					#user => "elastic"
  					#password => "changeme"
                }
         }
		 

```

 ![screenshot-2](https://us1.discourse-cdn.com/elastic/original/3X/4/5/45278ec62ddc0dc030b31b1af82882625f272567.png)

---

<div class="post-metadata">

**Author:** ![SP003](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sp003/32/112159_2.png) [@SP003](https://discuss.elastic.co/u/SP003)\
**Post date:** [February 1, 2023, 11:32am UTC](https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717/4 "2023-02-01T11:32:17Z")

</div>

Dear all,

Can I call a stored procedure in logstash config output? Please help me with syntax.

Thanks in advance.

Saroj

---

<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:** [March 1, 2023, 11:32am UTC](https://discuss.elastic.co/t/read-oracle-database-table-data-vi-logstash-to-insert-into-elasticsearch/323717/5 "2023-03-01T11:32:49Z")

</div>

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