-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest
More file actions
73 lines (67 loc) · 1.41 KB
/
Copy pathtest
File metadata and controls
73 lines (67 loc) · 1.41 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
input {
rabbitmq {
host => "10.0.1.36"
port => 5672
user => "guest"
password => "guest"
queue => "maxwell" # 声明 queue
exchange => "maxwell" # 绑定到 exchange
exchange_type => "fanout" # 类型要匹配 maxwell 的配置
auto_delete => false
ack => true
}
}
filter {
# 你可以在这里添加 grok 或 mutate 来处理 maxwell 的数据结构
# 例如:添加 @timestamp 或提取字段
json {
source => "message"
}
translate {
source => "[type]"
target => "[action]"
dictionary => {
"insert" => "index"
"bootstrap-insert" => "index"
"update" => "update"
"delete" => "delete"
}
}
mutate {
add_field => {
"id" => "%{[data][id]}"
"name" => "%{[data][name]}"
"age" => "%{[data][age]}"
"createdAt" => "%{[data][createdAt]}"
"updatedAt" => "%{[data][updatedAt]}"
}
remove_field => [
"message",
"original",
"@version",
"@timestamp",
"event",
"database",
"type",
"ts",
"xid",
"commit",
"data",
"old"
]
}
}
output {
elasticsearch {
hosts => ["http://10.0.1.36:9200"]
index => "%{[table]}"
document_id => "%{id}"
action => "%{action}"
user => "elastic"
password => "changeme"
}
# 将结果打印到标准输出
stdout {
codec => rubydebug
}
}