-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogstash-simple.conf
137 lines (129 loc) · 4.16 KB
/
logstash-simple.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
input {
redis {
data_type => channel
host => "${LOGSTASH_REDIS_HOST}"
id => joblogs_in
key => "logstash:in"
}
}
filter {
if "wflow-nonint" in [kubernetes][event][involved_object][name] {
grok {
match => { "[kubernetes][event][involved_object][name]" => "wflow-nonint-%{UUID:wflowid}%{GREEDYDATA}" }
}
grok {
match => { "[wflowid]" => "(?<idpart1>[A-Fa-f0-9]{2})(?<idpart2>[A-Fa-f0-9]{2})(?<idpart3>[A-Fa-f0-9]{2})%{GREEDYDATA:idrest}" }
}
mutate {
add_field => { "logdir" => "%{idpart1}/%{idpart2}/%{idpart3}/%{idrest}"}
add_field => { "msg_type" => "wflow_event"}
add_field => { "msg" => "%{[kubernetes][event][message]}"}
remove_field => ["idpart1", "idpart2", "idpart3", "idrest"]
}
}
if "wflow-job" in [kubernetes][event][involved_object][name] {
grok {
match => { "[kubernetes][event][involved_object][name]" => "wflow-job-%{UUID:jobid}%{GREEDYDATA}" }
}
grok {
match => { "[jobid]" => "(?<idpart1>[A-Fa-f0-9]{2})(?<idpart2>[A-Fa-f0-9]{2})(?<idpart3>[A-Fa-f0-9]{2})%{GREEDYDATA:idrest}" }
}
mutate {
add_field => { "logdir" => "%{idpart1}/%{idpart2}/%{idpart3}/%{idrest}"}
add_field => { "msg_type" => "subjob_event"}
add_field => { "msg" => "%{[kubernetes][event][message]}"}
remove_field => ["idpart1", "idpart2", "idpart3", "idrest"]
}
}
if [kubernetes][labels][component] == "wflow-engine" and [kubernetes][labels][interactive] == "false" {
grok {
match => { "[kubernetes][labels][wflowid]" => "(?<idpart1>[A-Fa-f0-9]{2})(?<idpart2>[A-Fa-f0-9]{2})(?<idpart3>[A-Fa-f0-9]{2})%{GREEDYDATA:idrest}" }
}
mutate {
add_field => { "logdir" => "%{idpart1}/%{idpart2}/%{idpart3}/%{idrest}"}
remove_field => ["idpart1", "idpart2", "idpart3", "idrest"]
add_field => { "msg_type" => "wflow_log"}
add_field => { "wflowguid" => "%{[kubernetes][labels][wflowid]}"}
add_field => { "msg" => "%{[message]}"}
add_field => { "date" => "%{@timestamp}"}
}
}
if [kubernetes][labels][component] == "wflow-job" {
grok {
match => { "[kubernetes][labels][jobid]" => "(?<idpart1>[A-Fa-f0-9]{2})(?<idpart2>[A-Fa-f0-9]{2})(?<idpart3>[A-Fa-f0-9]{2})%{GREEDYDATA:idrest}" }
}
mutate {
add_field => { "logdir" => "%{idpart1}/%{idpart2}/%{idpart3}/%{idrest}"}
add_field => { "msg_type" => "subjob_log"}
add_field => { "msg" => "%{[message]}"}
add_field => { "date" => "%{@timestamp}"}
remove_field => ["idpart1", "idpart2", "idpart3", "idrest"]
}
}
if [msg_type] == "wflow_state" {
grok {
match => { "[wflowguid]" => "(?<idpart1>[A-Fa-f0-9]{2})(?<idpart2>[A-Fa-f0-9]{2})(?<idpart3>[A-Fa-f0-9]{2})%{GREEDYDATA:idrest}" }
}
mutate {
add_field => { "logdir" => "%{idpart1}/%{idpart2}/%{idpart3}/%{idrest}"}
remove_field => ["idpart1", "idpart2", "idpart3", "idrest"]
}
}
}
output {
if [msg_type] == "wflow_event" {
file {
path => "${LOGSTASH_WFLOW_LOGBASE}/%{logdir}/events.log"
}
redis {
data_type => channel
host => "${LOGSTASH_REDIS_HOST}"
id => wflowevent_out
key => "logstash:out"
}
}
if [msg_type] == "subjob_event" {
file {
path => "${LOGSTASH_JOB_LOGBASE}/%{logdir}/events.log"
}
redis {
data_type => channel
host => "${LOGSTASH_REDIS_HOST}"
id => subjobevent_out
key => "logstash:out"
}
}
if [msg_type] == "wflow_log" and [kubernetes] {
file {
path => "${LOGSTASH_WFLOW_LOGBASE}/%{logdir}/log.log"
}
redis {
data_type => channel
host => "${LOGSTASH_REDIS_HOST}"
id => wflowlog_out
key => "logstash:out"
}
}
if [msg_type] == "subjob_log" {
file {
path => "${LOGSTASH_JOB_LOGBASE}/%{logdir}/run.log"
}
redis {
data_type => channel
host => "${LOGSTASH_REDIS_HOST}"
id => subjoblog_out
key => "logstash:out"
}
}
if [msg_type] == "wflow_state" {
file {
path => "${LOGSTASH_WFLOW_LOGBASE}/%{logdir}/state.log"
}
redis {
data_type => channel
host => "${LOGSTASH_REDIS_HOST}"
id => wflowstate_out
key => "logstash:out"
}
}
}