-
Notifications
You must be signed in to change notification settings - Fork 4
/
logstash-filebeat.conf
147 lines (125 loc) · 3.62 KB
/
logstash-filebeat.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
138
139
140
141
142
143
144
145
146
147
input {
beats {
port => "5044"
}
}
filter {
if " Event:" not in [message] {
drop {}
}
mutate {
gsub => [
"message", "LOCAL", "Resident"
]
}
# Date format parse.
grok {
ecs_compatibility => disabled
match => {
'message' => '\[%{TIMESTAMP_ISO8601:logtime}\].*Unique ID: %{GREEDYDATA:eventType},\n Event: %{GREEDYDATA:eventdata}'
}
}
json {
ecs_compatibility => disabled
source => "eventdata"
remove_field => ["eventdata","message"]
}
# Ruby code to convert the comma seperated roles into an array.
ruby{
code =>"
# Method to split the supplied string by comma, trim whitespace and return an array.
def mapStringToArray(strFieldValue)
# If string is not null, return array.
if (strFieldValue != nil)
fieldArr = strFieldValue.split(',').map(&:strip).reject(&:empty?).uniq
return fieldArr
end
# Return empty array if string is nil.
return []
end
vrtArr = mapStringToArray(event.get('[event][payloadData][rolesCommaSeparated]'))
if vrtArr.length > 0
event.set('[event][payloadData][rolesCommaSeparated]', vrtArr)
end
event_array = []
event_type = event.get('[event][payloadData][eventType]')
idp_type = event.get('[event][payloadData][identityProviderType]')
auth_step_success = event.get('[event][payloadData][authStepSuccess]')
if (event_type == 'overall' || auth_step_success == false)
event_array.push('Overall')
end
if (event_type == 'step')
if (idp_type == 'Resident')
event_array.push('Resident')
end
if (idp_type == 'FEDERATED')
event_array.push('Federated')
end
end
event.set('[event][payloadData][event_type_filter]', event_array)
"
}
# Take log time as the timestamp.
date {
match => [ "logtime" , "yyyy-MM-dd HH:mm:ss,SSS" ]
target => "@timestamp"
}
# Session specific.
if [eventType] == "session" {
# User agent filter to transform the userAgent string into seperated fields.
useragent {
ecs_compatibility => disabled
source => "[event][payloadData][userAgent]"
target => "userAgentDetails"
}
date {
match => [ "[event][payloadData][startTimestamp]" , "UNIX_MS" ]
target => "startTime"
}
date {
match => [ "[event][payloadData][terminationTimestamp]" , "UNIX_MS" ]
target => "endTime"
}
} else if [eventType] == "auth" {
# Geo ip filter to transform the IP address to location.
geoip {
ecs_compatibility => disabled
source => "[event][payloadData][remoteIp]"
}
# Geo IP failure to lookup or local address.
if "_geoip_lookup_failure" in [tags] {
mutate {
add_field => { "[geoip][country_name]" => "N/A" }
}
}
}
}
output {
# Separating event type as auth and session via the eventType.
if [eventType] == "auth" {
elasticsearch {
hosts => ["https://localhost:9200"]
cacert => "<ELASTICSEARCH_HOME>/config/certs/http_ca.crt"
user => "<ELASTICSEARCH_USERNAME>"
password => "<ELASTICSEARCH_USER_PASSWORD>"
index => "wso2-iam-auth-raw"
document_id => "%{[event][payloadData][eventId]}"
}
} else if [eventType] == "session" {
elasticsearch {
hosts => ["https://localhost:9200"]
cacert => "<ELASTICSEARCH_HOME>/config/certs/http_ca.crt"
user => "<ELASTICSEARCH_USERNAME>"
password => "<ELASTICSEARCH_USER_PASSWORD>"
index => "wso2-iam-session-raw"
document_id => "%{[event][payloadData][sessionId]}"
}
elasticsearch {
hosts => ["https://localhost:9200"]
cacert => "<ELASTICSEARCH_HOME>/config/certs/http_ca.crt"
user => "<ELASTICSEARCH_USERNAME>"
password => "<ELASTICSEARCH_USER_PASSWORD>"
index => "wso2-iam-session-time-series"
}
}
}