Reading multiple statusfile content and mapping to nested object


(Shah) #1

I have a scenarios where multiple status file will be written on a NAS location continuously until a process (build) completes.

folder1/status.txt
folder2/status.txt
folder3/status.txt
folder4/status.txt
......./.........


The content of status file is mentioned below

id : "1234" name : "xyz" place : "santaclara" product : product1 needs : dependent1,dependent2, os's : windows status : success product2 needs : dependent1,dependent4 os's : linux,mac status : fail build : build234 target : target234,target345, os's : linux,mac

I tried using the "file" plugin to read data, but in that case it read by line by line. and mapping it to a nested object as mentioned below became complicate. I wanted to have all the data inside each status file as nested object in a single document. Could you please suggest\provide some direction on how should I proceed?

The nested object out put I am looking for is
{ id : "" name : "" place : "" product { product1 { {[needs :"dependent1", "dependent2" os's :"windows" status : "success",] } build {......} }

Request any help on this.


(Magnus B├Ąck) #2

Reading entire files in one swoop with the file input is tricky. Perhaps the exec input would make more sense?


(system) #3