I am very new to ELK , need your guidance in my below usecase development.
We have lot of XML files generated from source server(around 55GB per day )..but, from each file, we need only very few lines.
There are 2 parameters(CO_ID_PUB,DIRNUM) are of interest in each of the XML trace containing transactions.
But, each of the transaction may or may not contain both of them. For example:
- Both CO_ID_PUB,DIRNUM are available
<COMMAND name="AAA.READ" timestamp="1574339699569" so="103">
<SVLOBJECT>
<STRING name="CO_ID_PUB" val="FFFFFFF"/>
</SVLOBJECT>
<RESULT>
...
<STRING name="DIRNUM" val="FFFFFFF"/>
....
</COMMAND>
<TX_COMMIT timestamp="1574339699585" so="103"/>
- Only CO_ID_PUB available
<COMMAND name="BBB.READ" timestamp="1574339699569" so="103">
<SVLOBJECT>
<STRING name="CO_ID_PUB" val="FFFFFFF"/>
</SVLOBJECT>
<RESULT>
...
....
</COMMAND>
<TX_COMMIT timestamp="1574339699585" so="103"/>
- Only DIRNUM available
<COMMAND name="CCC.READ" timestamp="1574339699569" so="103">
<SVLOBJECT>
<STRING name="DIRNUM" val="FFFFFFF"/>
</SVLOBJECT>
<RESULT>
...
....
</COMMAND>
<TX_COMMIT timestamp="1574339699585" so="103"/>
- Neither CO_ID_PUB,DIRNUM are not available
Each transaction starting with this below pattern:
<COMMAND name="AAA.READ" timestamp="1574339699569" so="103">
<SVLOBJECT>
<STRING name="CO_ID_PUB" val="FFFFFFF"/>
</SVLOBJECT>
<RESULT>
....
</COMMAND>
<TX_COMMIT timestamp="1574339699585" so="103"/>
but as i mentioned in the 4 scenarios, only if the below 2 fields present, then that particular transaction data such as start timestamp & end timestamp to be stored in ES.
Rest of the XML fields need to be dropped.
... ...
Then, i need to store data like below:
{ CO_ID_PUB:FFFFFFF, DIRNUM:KKKKK, StartTime:1574339699569 EndTime:1574339699585 name:AAA.READ} or
{ DIRNUM:FFFFFFF, DIRNUM:KKKKK, StartTime:1574339699569 EndTime:1574339699585 name:AAA.READ}
Once this data stored, user will query to get the transaction response time by providing CO_ID_PUB or DIRNUM
Can you help me with which logstash filter(xml or grok) and logic to develop parser ?