It got a bit more complicated with the 5.X versions of logstash, but I often test my filters using the stdin input and running logstash not as a service.
First create a configuration like below:
input {
stdin {
codec => json_lines
}
}
filter {
grok {
match => {"message" => "%{MONTHDAY} %{MONTH} %{YEAR} %{TIME},%{NUMBER:duration} %{WORD:loglevel} %{WORD:Activity} \[\{%{DATA:foo1}\}\]:(.*) execution time: %{NUMBER:executionTime} ms"}
}
kv {
source => "foo1"
field_split => ","
prefix => "foo_"
}
}
output {
stdout { codec => rubydebug}
}
Then run a standalone instance of logstash with your configuration. (Logstash 5.X requires you to also point to a settings file, so this exact phrase may not work anymore)
sudo /opt/logstash/bin/logstash -f ./logstash_groktest.conf
Take your message and turn it into JSON. I just put yours into to {"message":"your log message text here"}
Paste the JSON into your now running logstash instance.
Now look at what it spits out.
{
"message" => "01 Aug 2017 17:58:19,048 INFO ProfileAspect [{applicationSystemCode=appname, clientIP=10.x.x.x, clusterId=Cluster-Id-NA, containerId=Container-Id-NA, correlationId=536bacc1-1b50-3866-5c8c-8d0efa037f8f, domainName=defaultDomain, hostName=ip-x-x-x.domain.com, messageId=10.x.x.23-e2250a0e-b706-4e95-8e11-5b9bf310eabd, userId=ANONYMOUS, webAnalyticsCorrelationId=66D276FF1489DFF845056FD915664268|F90B27374FD5E26D2566CEE3AFDA3AB0}]: class com.provider.base.v1.HomeBaseApiConsumer.searchTasks execution time: 15 ms",
"@version" => "1",
"@timestamp" => "2017-08-02T19:16:53.996Z",
"host" => "SLCLOGSTASH01",
"duration" => "048",
"loglevel" => "INFO",
"Activity" => "ProfileAspect",
"foo1" => "applicationSystemCode=appname, clientIP=10.x.x.x, clusterId=Cluster-Id-NA, containerId=Container-Id-NA, correlationId=536bacc1-1b50-3866-5c8c-8d0efa037f8f, domainName=defaultDomain, hostName=ip-x-x-x.domain.com, messageId=10.x.x.23-e2250a0e-b706-4e95-8e11-5b9bf310eabd, userId=ANONYMOUS, webAnalyticsCorrelationId=66D276FF1489DFF845056FD915664268|F90B27374FD5E26D2566CEE3AFDA3AB0",
"executionTime" => "15",
"foo_applicationSystemCode" => "appname",
"foo_ clientIP" => "10.x.x.x",
"foo_ clusterId" => "Cluster-Id-NA",
"foo_ containerId" => "Container-Id-NA",
"foo_ correlationId" => "536bacc1-1b50-3866-5c8c-8d0efa037f8f",
"foo_ domainName" => "defaultDomain",
"foo_ hostName" => "ip-x-x-x.domain.com",
"foo_ messageId" => "10.x.x.23-e2250a0e-b706-4e95-8e11-5b9bf310eabd",
"foo_ userId" => "ANONYMOUS",
"foo_ webAnalyticsCorrelationId" => "66D276FF1489DFF845056FD915664268|F90B27374FD5E26D2566CEE3AFDA3AB0"
}
It looks like there is a space after each comma in your key value pairs. You would probably want to use the gsub mutate filter to get rid of those prior to putting it into KV. Using ", " instead of "," may also work.