Extract xml chunks from plain-text log file



I have a log that has SOAP request/response entries:



[2015-02-03 19:05:13] TIME:03.02.2015 19:05:13,
RAW_REQUEST:<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://ift.tt/sVJIaE" xmlns:ns1="pay_parent" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:ns2="providers"><SOAP-ENV:Body><!-- ... -->
</SOAP-ENV:Body></SOAP-ENV:Envelope>
,
uid:0de7d51a-abb6-11e4-a436-005056936d96,
===


I want to extract all xmls to a one big xml file (extract chunks and wrap with root ... tag). But also i need a date of log record.


I want (root xmlns attributes i could add with hands) to achieve same result:



<Records xmlns="" ...>
<Record datetime="2015-02-03 19:05:13">
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://ift.tt/sVJIaE" xmlns:ns1="pay_parent" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:ns2="providers"><SOAP-ENV:Body>
<!-- Other xml data -->
</SOAP-ENV:Body></SOAP-ENV:Envelope>
</Record>
...
</Records>

No comments:

Post a Comment