-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogstash.conf
63 lines (62 loc) · 1.74 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
56
57
58
59
60
61
62
63
input {
stdin {}
}
filter {
csv {
skip_header => true
columns => ["date","source","remark","location", "region", "ocpac_marking"]
remove_field => ["message", "host"]
}
mutate {
gsub => [
"location", "[\[\]]", ""
]
split => {
"ocpac_marking" => "//"
"location" => ","
}
}
ruby {
code => "
#clean up space before the latitude resulting from the previous comma split
originalLocation = event.get('location')
location = []
location << originalLocation[0].to_f
location << originalLocation[1].strip.to_f
event.set('location', location)
#break out all the components of the ocpac marking into their own fields
#we also want to set nils to empty lists to greatly simplify our ABAC logic
ocpac = event.get('ocpac_marking')
compartments = []
dissemination = []
if ocpac.length == 3 #for level//compartments//dissem
compartments = ocpac[1].split('/')
dissemination = ocpac[2]
elsif ocpac.length == 2
if ['NROFON','OUOF','EYEEVIF'].include? ocpac[1]
compartments = ['NONE']
dissemination = ocpac[1]
else
compartments = ocpac[1].split('/')
dissemination = ['NONE']
end
end
event.set('security_level', ocpac[0])
event.set('security_compartments', compartments)
event.set('security_compartments_min', compartments.count)
event.set('security_dissemination', dissemination)
"
remove_field => ["ocpac_marking"]
}
}
output {
elasticsearch {
hosts => "http://localhost:9200/"
index => "elasticon-dc-2018"
user => "elastic"
password => "changeme"
}
# stdout {
# codec => "rubydebug"
# }
}