-
Notifications
You must be signed in to change notification settings - Fork 2
/
pan-os.conf
211 lines (200 loc) · 9.97 KB
/
pan-os.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
input {
# Input for PAN-OS device log
udp {
host => "0.0.0.0"
port => "5514"
type => "udp"
tags => [ "PAN-OS_syslog" ]
}
}
filter {
if "PAN-OS_syslog" in [tags] {
# Log types are "TRAFFIC", "THREAT", "CONFIG" and "SYSTEM".
# Threat log fields: https://docs.paloaltonetworks.com/pan-os/8-1/pan-os-admin/monitoring/use-syslog-for-monitoring/syslog-field-descriptions/threat-log-fields.html
if ([message] =~ /THREAT/) {
csv {
source => "message"
columns => [
"Domain", "ReceiveTime", "SerialNumber", "Type", "Threat_ContentType", "Config Version",
"GeneratedTime", "SourceIP", "DestinationIP", "NATSourceIP", "NATDestinationIP", "RuleName",
"SourceUser", "DestinationUser", "Application", "VirtualSystem", "SourceZone", "DestinationZone",
"InboundInterface", "OutboundInterface", "LogForwardingProfile", "Time Logged", "SessionID",
"RepeatCount", "SourcePort", "DestinationPort", "NATSourcePort", "NATDestinationPort", "Flags",
"Protocol", "Action", "URL_Filename", "ThreatID", "URLCategory", "Severity", "Direction",
"SequenceNumber", "ActionFlags", "SourceLocation", "DestinationLocation", "cpadding",
"ContentType", "PCAP_ID", "FileDigest", "Cloud", "URLIndex", "UserAgent", "FileType",
"X-Forwarded-For", "Referer", "Sender", "Subject", "Recipient", "ReportID",
"DeviceGroupHierarchyLevel1", "DeviceGroupHierarchyLevel2", "DeviceGroupHierarchyLevel3",
"DeviceGroupHierarchyLevel4", "VirtualSystemName", "DeviceName", "File_URL", "SourceVMUUID",
"DestinationVMUUID", "HTTPMethod", "TunnelID_IMSI", "MonitorTag_IMEI", "ParentSessionID",
"ParentStartTime", "TunnelType", "ThreatCategory", "ContentVersion", "SigFlags"
]
}
mutate {
convert => [ "GeoIP.dma_code", "integer" ]
convert => [ "GeoIP.latitude", "float" ]
convert => [ "GeoIP.longitude", "float" ]
convert => [ "NATDestinationPort", "integer" ]
convert => [ "NATSourcePort", "integer" ]
convert => [ "SequenceNumber", "integer" ]
add_tag => ["PAN-OS_threat"]
}
} # End of if message is THREAT
# Traffic log fields: https://docs.paloaltonetworks.com/pan-os/8-1/pan-os-admin/monitoring/use-syslog-for-monitoring/syslog-field-descriptions/traffic-log-fields.html
else if ([message] =~ /TRAFFIC/) {
csv {
source => "message"
columns => [
"Domain", "ReceiveTime", "SerialNumber", "Type", "Threat_ContentType", "Config Version",
"GeneratedTime", "SourceIP", "DestinationIP", "NATSourceIP", "NATDestinationIP", "RuleName",
"SourceUser", "DestinationUser", "Application", "VirtualSystem", "SourceZone", "DestinationZone",
"InboundInterface", "OutboundInterface", "LogForwardingProfile", "TimeLogged", "SessionID",
"RepeatCount", "SourcePort", "DestinationPort", "NATSourcePort", "NATDestinationPort", "Flags",
"Protocol", "Action", "Bytes", "BytesSent", "BytesReceived", "Packets", "StartTime", "ElapsedTime",
"URLCategory", "Padding", "SequenceNumber", "ActionFlags", "SourceLocation",
"DestinationLocation", "cpadding", "PacketsSent", "PacketsReceived", "SessionEndReason",
"DeviceGroupHierarchyLevel1", "DeviceGroupHierarchyLevel2", "DeviceGroupHierarchyLevel3",
"DeviceGroupHierarchyLevel4", "VirtualSystemName", "DeviceName", "ActionSource", "SourceVMUUID",
"DestinationVMUUID", "TunnelID_IMSI", "MonitorTag_IMEI", "ParentSessionID", "ParentStartTime",
"TunnelType"
]
}
mutate {
convert => [ "Bytes", "integer" ]
convert => [ "BytesReceived", "integer" ]
convert => [ "BytesSent", "integer" ]
convert => [ "ElapsedTime", "integer" ]
convert => [ "GeoIP.dma_code", "integer" ]
convert => [ "GeoIP.latitude", "float" ]
convert => [ "GeoIP.longitude", "float" ]
convert => [ "NATDestinationPort", "integer" ]
convert => [ "NATSourcePort", "integer" ]
convert => [ "Packets", "integer" ]
convert => [ "PacketsReceived", "integer" ]
convert => [ "PacketsSent", "integer" ]
convert => [ "SequenceNumber", "integer" ]
add_tag => [ "PAN-OS_traffic"]
}
}
# Config log fields: https://docs.paloaltonetworks.com/pan-os/8-1/pan-os-admin/monitoring/use-syslog-for-monitoring/syslog-field-descriptions/config-log-fields.html
else if ([message] =~ /CONFIG/) {
csv {
source => "message"
columns => [
"Domain", "ReceiveTime", "SerialNumber", "Type", "Threat_ContentType", "Config Version","Generated Time",
"Host","VirtualSystem", "Command", "Admin", "Client", "Result", "ConfigurationPath",
"BeforeChangeDetail","AfterChangeDetail", "SequenceNumber", "ActionFlags",
"DeviceGroupHierarchyLevel1","DeviceGroupHierarchyLevel2", "DeviceGroupHierarchyLevel3",
"DeviceGroupHierarchyLevel4","VirtualSystemName", "DeviceName"
]
}
mutate {
add_tag => [ "PAN-OS_config"]
}
}
# System log fields: https://docs.paloaltonetworks.com/pan-os/8-1/pan-os-admin/monitoring/use-syslog-for-monitoring/syslog-field-descriptions/system-log-fields.html
else if ([message] =~ /SYSTEM/) {
csv {
source => "message"
columns => [
"Domain", "ReceiveTime", "SerialNumber", "Type", "Threat_ContentType", "Config Version", "GeneratedTime",
"VirtualSystem", "EventID", "Object", "FMT", "ID", "Module", "Severity", "Description",
"SequenceNumber", "ActionFlags", "DeviceGroupHierarchyLevel1", "DeviceGroupHierarchyLevel2",
"DeviceGroupHierarchyLevel3", "DeviceGroupHierarchyLevel4", "VirtualSystemName", "DeviceName"
]
}
mutate {
add_tag => [ "PAN-OS_system"]
}
}
date {
match => [ "GeneratedTime", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm"]
remove_field => ["GeneratedTime"]
}
# Original message has been fully parsed, so remove it.
mutate {
remove_field => [ "message" ]
}
# Geolocate logs that have SourceIP if that SourceIP is a non-RFC1918 address
if [SourceIP] and [SourceIP] !~ "(^127\.0\.0\.1)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)|(^169\.254\.)" {
geoip {
source => "SourceIP"
target => "SourceIPGeo"
}
# Delete 0,0 in SourceIPGeo.location if equal to 0,0
if ([SourceIPGeo.location] and [SourceIPGeo.location] =~ "0,0") {
mutate {
replace => [ "SourceIPGeo.location", "" ]
}
}
}
# Geolocate logs that have DestinationIP and if that DestinationIP is a non-RFC1918 address
if [DestinationIP] and [DestinationIP] !~ "(^127\.0\.0\.1)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)|(^169\.254\.)" {
geoip {
source => "DestinationIP"
target => "DestinationIPGeo"
}
# Delete 0,0 in DestinationIPGeo.location if equal to 0,0
if ([DestinationIPGeo.location] and [DestinationIPGeo.location] =~ "0,0") {
mutate {
replace => [ "DestinationIPGeo.location", "" ]
}
}
}
# Takes the 5-tuple of source address, source port, destination address, destination port, and protocol and does a SHA1 hash to fingerprint the flow. This is a useful
# way to be able to do top N terms queries on flows, not just on one field.
if [SourceIP] and [DestinationIP] {
fingerprint {
concatenate_sources => true
method => "SHA1"
key => "logstash"
source => [ "SourceIP", "SourcePort", "DestinationIP", "DestinationPort", "Protocol" ]
}
}
metrics {
meter => "events"
add_tag => "metric"
}
} # End of if PAN-OS_syslog in tags
}
output {
if "PAN-OS_traffic" in [tags] {
elasticsearch {
hosts => [ 'elasticsearch' ]
index => "traffic-%{+YYYY.MM}"
}
#stdout { codec => rubydebug }
}
else if "PAN-OS_threat" in [tags] {
elasticsearch {
hosts => [ 'elasticsearch' ]
index => "threat-%{+YYYY.MM}"
}
#stdout { codec => rubydebug }
}
else if "PAN-OS_system" in [tags] {
elasticsearch {
hosts => [ 'elasticsearch' ]
index => "system-%{+YYYY.MM}"
}
#stdout { codec => rubydebug }
}
else if "PAN-OS_config" in [tags] {
elasticsearch {
hosts => [ 'elasticsearch' ]
index => "config-%{+YYYY.MM}"
}
#stdout { codec => rubydebug }
}
else if "metric" in [tags] {
elasticsearch {
hosts => [ 'elasticsearch' ]
index => "metric-%{+YYYY.MM}"
}
}
else {
file {
path => "/var/log/logstash/failed_pan-os_events-%{+YYYY.MM}.log"
}
}
}