Guest User

Untitled

a guest
Jan 15th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. input {
  2. jdbc {
  3. #jdbc connector should be stored in the logstash docker container
  4. jdbc_driver_library => "/usr/share/logstash/mysql-driver/mysql-connector-java-5.1.47-bin.jar"
  5. jdbc_driver_class => "com.mysql.jdbc.Driver"
  6. jdbc_connection_string => "jdbc:mysql://xxx.162.xxx.101:3306/employee_db"
  7. jdbc_user => "root"
  8. jdbc_password => "root123"
  9. #logstash will be run in every minute as scheduled below.
  10. schedule => "* * * * *"
  11. statement => "SELECT * from employees where status = 'active'"
  12. }
  13. }
  14.  
  15. filter {
  16. # age,password and address fields will not be sent to the elasticsearch
  17. mutate { remove_field => [ "age", "password","address"] }
  18.  
  19. #following sql fields will be renamed/mapped in elasticsearch as follows
  20. mutate { rename => {"employment_designation" => "designation"} }
  21. mutate { rename => {"contact_email" => "email"} }
  22. mutate { rename => {"mobile_number" => "mobile"} }
  23. }
  24.  
  25. output{
  26. # starting from elasticsearch 6, only one type/mapping is allowed per index.
  27. elasticsearch {
  28. hosts => ["elasticsearch:9200"]
  29. index => "company_employees"
  30. # id field of the sql result set will be mapped as the document id
  31. document_id => "%{id}"
  32. }
  33. }
Add Comment
Please, Sign In to add comment