Mark,
I appreciate options.
Here is the logstash config, complete with my commented ramblings...
input {
beats {
port => 5044
}
}
filter {
# Grab the timestamp and the whole json message and store them in separate fields
grok {
match => { "message" => "%{TIMESTAMP_ISO8601:log_timestamp_tmp} - %{GREEDYDATA:json_message}" }
}
# Turn the log_timestamp_tmp into an actual date type and assign it to @log_timestamp
date {
match => [ "log_timestamp_tmp", "yyyy-MM-dd HH:mm:ss" ]
target => "@log_timestamp"
remove_field => [ "log_timestamp_tmp" ]
}
# Suck up the json data in json_message
json {
source => "json_message"
remove_field => [ "json_message" ]
}
# Use Standardized field names
mutate {
rename => { "type" => "EventType" }
# rename => { "r/o" => "EventType" }
# rename => { "booting" => "EventType" }
rename => { "version" => "DeviceVersion" }
rename => { "user" => "SourceUserName" }
rename => { "domainUUID" => "EventExternalId" }
rename => { "access" => "DeviceVirtualSystem" }
# rename => { "remote-address" => "SourceIPAddress" }
rename => { "success" => "DeviceActionResult" }
# rename => { "ops" => "DeviceAction" }
}
# Grab out just one of the two duplicate IP addresses
grok {
match => { "remote-address" => "%{IP:SourceIPAddress}" }
remove_field => [ "remote-address" ]
}
}
output {
stdout {
codec => rubydebug
}
}
This is what the output of Log Entry 1 (from above) looks like after going through the logstash parsing.
{
"message" => "2017-11-01 15:44:34 - {\n\"type\" : \"core\",\n\"r/o\" : false,\n\"booting\" : false,\n\"version\" : \"6.4.16.GA\",\n\"user\" : \"eap-dc\",\n\"domainUUID\" : \"fa136abb-08fc-4a9d-a488-f059276af9f2\",\n\"access\" : \"NATIVE\",\n\"remote-address\" : \"10.1.2.3/10.1.2.3\",\n\"success\" : true,\n\"ops\" : [{\n\"address\" : [\n{\n\"core-service\" : \"management\"\n},\n{\n\"access\" : \"audit\"\n},\n{\n\"logger\" : \"audit-log\"\n}\n],\n\"operation\" : \"write-attribute\",\n\"name\" : \"log-read-only\",\n\"value\" : true,\n\"operation-headers\" : {\n\"access-mechanism\" : \"NATIVE\",\n\"domain-uuid\" : \"fa136abb-08fc-4a9d-a488-f059276af9f2\",\n\"execute-for-coordinator\" : true\n}\n}]\n}",
"@version" => "1",
"@timestamp" => "2017-11-06T16:03:35.625Z",
"source" => "",
"offset" => 0,
"input_type" => "stdin",
"beat" => {
"name" => "adm-d-logstash.domain.com",
"hostname" => "adm-d-logstash.domain.com",
"version" => "5.6.3"
},
"host" => "adm-d-logstash.domain.com",
"tags" => [
[0] "beats_input_codec_plain_applied"
],
"@log_timestamp" => "2017-11-01T15:44:34.000Z",
"r/o" => false,
"booting" => false,
"ops" => [
[0] {
"address" => [
[0] {
"core-service" => "management"
},
[1] {
"access" => "audit"
},
[2] {
"logger" => "audit-log"
}
],
"operation" => "write-attribute",
"name" => "log-read-only",
"value" => true,
"operation-headers" => {
"access-mechanism" => "NATIVE",
"domain-uuid" => "fa136abb-08fc-4a9d-a488-f059276af9f2",
"execute-for-coordinator" => true
}
}
],
"EventType" => "core",
"DeviceVersion" => "6.4.16.GA",
"SourceUserName" => "eap-dc",
"EventExternalId" => "fa136abb-08fc-4a9d-a488-f059276af9f2",
"DeviceVirtualSystem" => "NATIVE",
"DeviceActionResult" => true,
"SourceIPAddress" => "10.1.2.3"
}
Here is another log entry after it's gone through logstash.
{
"message" => "2017-10-23 15:12:24 - {\n \"type\" : \"core\",\n \"r/o\" : true,\n \"booting\" : false,\n \"version\" : \"6.4.16.GA\",\n \"user\" : \"$local\",\n \"domainUUID\" : null,\n \"access\" : \"NATIVE\",\n \"remote-address\" : \"10.2.3.4/10.2.3.4\",\n \"success\" : true,\n \"ops\" : [{\n \"address\" : [\n {\n \"host\" : \"master\"\n },\n {\n \"core-service\" : \"management\"\n },\n {\n \"access\" : \"audit\"\n },\n {\n \"server-logger\" : \"audit-log\"\n }\n ],\n \"operation\" : \"read-operation-description\",\n \"name\" : \"write-attribute\",\n \"operation-headers\" : {\n \"caller-type\" : \"user\",\n \"access-mechanism\" : \"NATIVE\"\n }\n }]\n}",
"@version" => "1",
"@timestamp" => "2017-11-06T16:01:54.505Z",
"input_type" => "stdin",
"beat" => {
"name" => "adm-d-logstash.domain.com",
"hostname" => "adm-d-logstash.domain.com",
"version" => "5.6.3"
},
"source" => "",
"offset" => 0,
"host" => "adm-d-logstash.domain.com",
"tags" => [
[0] "beats_input_codec_plain_applied"
],
"@log_timestamp" => "2017-10-23T15:12:24.000Z",
"r/o" => true,
"booting" => false,
"ops" => [
[0] {
"address" => [
[0] {
"host" => "master"
},
[1] {
"core-service" => "management"
},
[2] {
"access" => "audit"
},
[3] {
"server-logger" => "audit-log"
}
],
"operation" => "read-operation-description",
"name" => "write-attribute",
"operation-headers" => {
"caller-type" => "user",
"access-mechanism" => "NATIVE"
}
}
],
"EventType" => "core",
"DeviceVersion" => "6.4.16.GA",
"SourceUserName" => "$local",
"EventExternalId" => nil,
"DeviceVirtualSystem" => "NATIVE",
"DeviceActionResult" => true,
"SourceIPAddress" => "10.2.3.4"
}
Let me know if I missed anything.
Thanks