-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_input_example.conf
26 lines (25 loc) · 1.19 KB
/
database_input_example.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Command to run Microsoft SQL on Linux - ASSUMES DOCKER IS INSTALLED
# docker run -it -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=$3curePassword' -p 1433:1433 --rm mcr.microsoft.com/mssql/server
#
# Micrsofot SQL Management Studio download link - https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15
#
# JAR driver download link - https://docs.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server
# Make sure downloaded jar matches JDK version Logstash is using.
# Also, copy jar file into /usr/share/logstash/logstash-core/lib/jars
input {
jdbc {
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
# Change localhost to DNS or IP of database server and change databaseName
jdbc_connection_string => "jdbc:sqlserver://localhost;databaseName=test"
jdbc_user => "sa" # do not use sa in production
jdbc_password => "$3curePassword"
tracking_column => "id"
last_run_metadata_path => "/usr/share/logstash/config/jdbc_last_run"
schedule => "* * * * *"
statement => "SELECT * FROM table2"
add_field => { "log_event_type" => "database" }
}
}
output {
stdout { codec => rubydebug }
}