Created
November 1, 2015 19:36
-
-
Save ableasdale/8539247c7fb513a3fdac to your computer and use it in GitHub Desktop.
Parse a support dump and generate a CSV for *some* values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
(text{"Forest Name,State,Rebalancer Enabled,Rebalancing,Stand Count,On Disk Size (MiB),In Mem Size (MiB)"}, | |
for $i in doc() | |
where starts-with(xdmp:node-uri($i), "/MY_APP_FOREST_NAMES_HERE") | |
order by xdmp:node-uri($i) | |
return | |
text {string-join( (xs:string($i//*:forest-name), xs:string($i//*:state), xs:string($i//*:rebalancer-enable), xs:string($i//*:rebalancing), xs:string(fn:count($i//*:stands/*:stand)), xs:string(fn:sum( xs:integer($i//*:stands/*:stand/*:disk-size))), xs:string(fn:sum( xs:integer($i//*:stands/*:stand/*:memory-size))) ), ",")}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
for $i in xdmp:document-get("E:\supportdump.txt", <options xmlns="xdmp:document-get"> | |
<format>xml</format> | |
<repair>full</repair> | |
</options>)/*:forest-status | |
return xdmp:document-insert(concat("/",$i/*:forest-name,".xml"), $i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment