-
Notifications
You must be signed in to change notification settings - Fork 0
/
logstash.conf
55 lines (48 loc) · 1.35 KB
/
logstash.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
input {
jdbc {
add_field => {"field_type"=>"jdbc"}
# mysql jdbc connection string to our backup databse
jdbc_connection_string => "jdbc:mysql://localhost:3306/test?useSSL=false"
# the user we wish to excute our statement as
jdbc_user => "root"
jdbc_password => "3664"
# the path to our downloaded jdbc driver
jdbc_driver_library => "/home/chris/ubuntuSoftware/logstash-2.4.1/mysql-connector-java-8.0.11.jar"
# the name of the driver class for mysql
jdbc_driver_class => "com.mysql.cj.jdbc.Driver"
jdbc_paging_enabled => "true"
jdbc_page_size => "50000"
#statement_filepath => "//bin/jdbc.sql"
statement => "select id,subject,capacity,ordered from course"
schedule => "* * * * *"
type => "searchcourse"
}
tcp {
add_field => {"field_type"=>"logback"}
port => 4567
codec => json_lines
}
}
filter {
if [field_type] == "jdbc" {
json {
source => "message"
remove_field => ["message"]
}
}
}
output {
if [field_type] == "jdbc" {
elasticsearch {
hosts => "127.0.0.1:9200"
index => "selectionsystem"
document_id => "%{id}"
}
}
if [field_type] == "logback" {
elasticsearch {
hosts => "localhost:9200"
index => "logback-log"
}
}
}