Hi ,
I like to pass payload to another logstash config file and post the payload fields to ES once it successfully it will post other fields to ES.
filter
{
if "START [[" in [message]
{
grok
{
match => { "message" => "%{TIMESTAMP_ISO8601:logtime} %{LOGLEVEL:loglevel} %{DATA:audittype} %{DATA:app} - %{GREEDYDATA:jsondata}" }
}
json { source => "jsondata" }
mutate { add_field => { "RequestTimeStamp" => "%{[event][timestamp]}"
"LogLevel" => "%{[event][logLevel]}"
"Tracepoint" => "%{[event][tracepoint]}"
"ApplicationName" => "%{[event][appName]}"
"AppVersion" => "%{[event][appVersion]}"
"Environment" => "%{[event][environment]}"
"BusinessGroup" => "%{[event][businessGroup]}"
"InterfaceName" => "%{[event][interfaceName]}"
"CID" => "%{[event][correlationId]}"
"TID" => "%{[event][traceId]}"
"FlowName" => "%{[event][locationInfo][flowName]}"
"TracePointDesc" => "%{[event][tracepointDesc]}"
"Payload" => "%{[event][content][payload]}"
}
}
# Need to pass payload to another logstash config and parse and send to ES
dissect { mapping => { "sourcetype" => "%{SourceSystem}" } }
mutate { remove_field => ["sourcetype","app","jsondata","payload","message","event","Payload"] }
}
output {
if [audittype]=="START" or [audittype]=="END"
{
elasticsearch
{
id => "estraveldemoid"
index => "traveldemoindex"
hosts => ["localhost:9200"]
}
stdout {}
}
}
Sample Log:
2020-04-27 00:44:30,445 INFO START [[Thread1]]custom.utils.logger -
{
"sourcetype":"Travel Agency Application",
"event":{
"timestamp":"2020-04-29T00:00:00.000",
"logLevel":"INFO",
"tracepoint":"START",
"appName":"Travel Booking website",
"appVersion":"1.0.0","environment":"DEV",
"businessGroup":"TravelBookingGroup",
"interfaceName":"TourBookingInterface",
"correlationId":"TBT017",
"traceId":"MMT003","threadName":"",
"locationInfo":{"flowName":"bookingTravelTickets"},
"tracepointDesc":"START Transaction - Travel Booking Website",
"content":{
"payload":{
"Date": "28.04.2020",
"Name": "KARTHIK",
"Origin":"MAA",
"Destination":"FRK",
"AirlineBooking":"Yes",
"HotelBooking":"Yes",
"TaxiBooking": "YES"
}
}
}
}
It will work? How we can call another logstash.Config and get the control back to first Logstsh file?
Regards,
Karthikeyan S