Skip to content

Instantly share code, notes, and snippets.

@tsundara
Last active January 24, 2017 21:00
Show Gist options
  • Save tsundara/ca70fee65b075184428f2651bdd52b72 to your computer and use it in GitHub Desktop.
Save tsundara/ca70fee65b075184428f2651bdd52b72 to your computer and use it in GitHub Desktop.
Oracle to Logstash - Sample
#A sample config file for exporting data from Oracle to ElasticSearch
#Note the capital J in "Java" for jdbc_driver_class
input {
jdbc {
jdbc_connection_string => "jdbc:oracle:thin:@oraclehost:1522/ORASID"
jdbc_user => "oracle_user"
jdbc_password => "oracle_password"
jdbc_driver_library => "/home/tsundara/elk/logstash-2.3.4/lib/jdbc_libs/ojdbc6.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
statement => "SELECT * from ADDRESS where STATE_PROVINCE='NJ'"
}
}
output {
stdout { codec => json_lines }
}
# How to run it
export JAVA_HOME=/path/to/jdk8
./logstash-2.3.4/bin/logstash -f oracle_to_elastic.conf Logstash startup
#Check1 : Get the list of existing indexes (2 ways listed below)
curl http://localhost:9200/_aliases?pretty=1
curl 'localhost:9200/_cat/indices?v'
# Display the data for "blog" index
curl -XGET "http://localhost:9200/blog/_search?size=50&pretty"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment