Hi...
I have a Azure CosmosDB log message in this format:
{
"records":
[
{
"time": "Fri, 23 Jun 2017 19:29:50.266 GMT",
"resourceId": "contosocosmosdb",
"category": "DataPlaneRequests",
"operationName": "Query",
"resourceType": "Database",
"properties": {"activityId": "05fcf607-6f64-48fe-81a5-f13ac13dd1eb","userAgent": "documentdb-dotnet-sdk/1.12.0 Host/64-bit MicrosoftWindowsNT/6.2.9200.0 AzureSearchIndexer/1.0.0",
"resourceType": "Database","statusCode": "200","documentResourceId": "","clientIpAddress": "13.92.241.0","requestCharge": "2.260","collectionRid": "",
"duration": "9250","requestLength": "72","responseLength": "209", "resourceTokenUserRid": ""}
}
]
}
I'm trying to split each field but facing some issues with the logstash split filter.
Error: [WARN ][logstash.filters.split ] Only String and Array types are splittable. field:records is of type = NilClass
This is my logstash config file:
input
{
azureblob
{
storage_account_name => "XXXX"
storage_access_key => "XXX"
container => "dataplanerequests"
registry_create_policy => "resume"
type => "XXX"
codec => json
}
filter {
if [type] == "XXX"
{
split
{
field => "records"
add_field => {
"logtime" => "%{[records][time]}"
"operationName" => "%{[records][operationName]}"
"category" => "%{[records][category]}"
"activityId" => "%{[records][properties][activityId]}"
"requestResourceType" => "%{[records][properties][requestResourceType]}"
"requestResourceId" => "%{[records][properties][requestResourceId]}"
"collectionRid" => "%{[records][properties][collectionRid]}"
"statusCode" => "%{[records][properties][statusCode]}"
"duration" => "%{[records][properties][duration]}"
"userAgent" => "%{[records][properties][userAgent]}"
"clientIpAddress" => "%{[records][properties][clientIpAddress]}"
"requestCharge" => "%{[records][properties][requestCharge]}"
"requestLength" => "%{[records][properties][requestLength]}"
"responseLength" => "%{[records][properties][responseLength]}"
"region" => "%{[records][properties][region]}"
}
remove_field => ["records"]
}
}
}
output
{
if [type] == "XXX"
{
kafka
{
codec => json_lines
topic_id => "XXX"
bootstrap_servers => "XXX"
id => "XXX"
}
}
}
Few logs are able to parse properly but few are unable to parse.