0

I have a file which contains multiple JSON lines. I am able to transform them into the below structure.

{
            "@version" => "1",
                 "key" => "my_key",
           "host_name" => "machine1",
          "@timestamp" => 2020-08-03T09:21:11.014Z,
    "epoch_value_pair" => {
        "1596175350" => "4",
        "1596178945" => "5",
        "1596178920" => "4",
        "1596175380" => "4",
        "1596178975" => "7",
        "1596175365" => "4",
        "1596175335" => "4"
    },
                "host" => "host machine"
}

Now how do I convert this into a csv file with ["host_name", "key", "epoch", "value"]?

Expected output is:

host_name,key,epoch,value

machine1,my_key,1596175350,4

machine1,my_key,1596178945,5

machine1,my_key,1596178920,4

CSV output plugin is not helping. Can someone please help?

0 Answers0