Parse multiline CSV files of different headers using logstash http input

Hi,

Is there a way to parse multiple CSV files of different headers using logstash.

EG:

  1. Post a csv file using curl command

curl -XPOST 'http://10.197.37.94:31311' --data-binary @mycsv.csv -H 'Content-type:text/csv; charset=utf-8'

mycsv.csv
date,Hostname,procesName,processId
1522770001,10.12.13.13,service1,1068
1522770601,10.12.13.13,service1,1068

Expected out put to store in Elastic search
{
{
"date": 1522770001,
"vcName": "10.12.13.13",
"procesName": "service1",
"processId": 1068
},
{
"date": 1522770601,
"vcName": "10.12.13.13",
"procesName": "service1",
"processId": 1068
}
}

  1. Post second csv file with different header using curl command

curl -XPOST 'http://10.197.37.94:31311' --data-binary @mycsv1.csv -H 'Content-type:text/csv; charset=utf-8'

mycsv1.csv
date,Hostname,service,cpu,memory,disk
1522770001,10.12.13.13,service1,1068,1,30
1522770601,10.12.13.13,service2,1068,2,50

Expected out put to store in Elastic search
{
"date": 1522770001,
"Hostname": "10.12.13.13",
"service": "service1",
"cpu": 1068,
"memory": 1,
"disk": 30
},
{
"date": 1522770601,
"Hostname": "10.12.13.13",
"service": "service2",
"cpu": 1068,
"memory": 2,
"disk": 50
}

Thanks in advance

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.