Dashboards & Visualizations

How to break XML response in multi-line events?

vikas_baranwal
Path Finder

Hello,

I am trying to break the XML response in multi-line events but not able to do so.
In the attached URL, Ist highlighted "-1" is version id and 2nd highlighted "-1" is cycle id, and I want to get all the cycle id from the XML response. Please advise how I can achieve this.

add https:// with imgur.com/j0db7gi ( don't have enough karma points to check URL)

Thank you so much!

0 Karma
1 Solution

FrankVl
Ultra Champion

That's not XML, that's JSON.

I think this should work:

SHOULD_LINEMERGE = false
LINE_BREAKER = (,[\r\n]+)\"[\-\d]+\":{[\r\n]+\"totalExecutions

https://regex101.com/r/08pw0c/1

View solution in original post

0 Karma

FrankVl
Ultra Champion

That's not XML, that's JSON.

I think this should work:

SHOULD_LINEMERGE = false
LINE_BREAKER = (,[\r\n]+)\"[\-\d]+\":{[\r\n]+\"totalExecutions

https://regex101.com/r/08pw0c/1

0 Karma

vikas_baranwal
Path Finder

Apologies writing incorrectly AS XML rather than JSON.

Thanks for sharing your solution but that did work. I tried to use syntax and changed that. But still output is still not achieved correctly. I shared URL for you with sample data regex exp.

[Test]
SHOULD_LINEMERGE = false
LINE_BREAKER = "([0-9?-]*)"[:.*$][^:\n^{]\"totalExecutions
INDEXED_EXTRACTIONS =

In my output I am getting like below, still numeric values are not showing as line breaker in output

":{"totalExecutions":56,"endDate":"","description":"","totalExecuted":56,"started":"","versionName":"Excalibur Web 1.4","expand":"executionSummaries","projectKey":"ESS","versionId":14176,"environment":"","totalCycleExecutions":0,"totalDefects":0,"build":"","createdBy":"JAllwood","ended":"","name":"Celebrity Web Test Cases","totalFolders":4,"modifiedBy":"jallwood","projectId":11700,"createdByDisplay":"Jesus Allwood","startDate":"","executionSummaries":{"executionSummary":[]}},"recordsCount":2}]}

Sorry again for not able share my URL properly.

https:// [ADD this] regex101.com/r/ulyMpO/1

0 Karma

FrankVl
Ultra Champion

Ok, that sample data is different from what you shared before. That explains why my regex didn't work.

Note: anything you put into the capturing group (between ()) will be stripped during linebreaking, so if you don't want the number to be stripped, don't put it into the capturing group. Also: your regex is rather messy and contains a lot of weird things. The following works as well: (,?)\"[\-\d]+\":{\"totalExecutions

See: https://regex101.com/r/ulyMpO/2

0 Karma

vikas_baranwal
Path Finder

Hi Frank,

I am so happy after finding out solution and your valuable suggestions. I am able to extract desired output.
Thanks once again. Please change solution as Accepted Answer.

0 Karma

FrankVl
Ultra Champion

Glad to hear it worked. You will need to mark my answer as accepted, I can't do that myself 🙂

0 Karma

marycordova
SplunkTrust
SplunkTrust

one of these in the props.conf file might help also:

KV_MODE = json

OR

AUTO_KV_JSON = true

OR

INDEXED_EXTRACTIONS = < CSV|W3C|TSV|PSV|JSON>

@marycordova
0 Karma

FrankVl
Ultra Champion

Please post a sample of the raw XML. Make sure to post it as code, using the 101010 button in the message editor here.

0 Karma

vikas_baranwal
Path Finder

{
"-1":[
{
"-1":{
"totalExecutions":513,
"totalExecuted":476,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"totalCycleExecutions":513,
"name":"Ad hoc",
"modifiedBy":"",
"projectId":10101,
"startDate":"",
"executionSummaries":{
"executionSummary":[
]
}
},
"29":{
"totalExecutions":0,
"totalExecuted":0,
"started":"",
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"totalCycleExecutions":0,
"totalDefects":0,
"name":"Full Regression - X.X.X (Android)",
"totalFolders":0,
"modifiedBy":"sudeepjames",
"projectId":10101,
"createdByDisplay":"Arnaldo Ramirez",
"startDate":"",
"executionSummaries":{
"executionSummary":[
]
}
},
"73":{
"totalExecutions":332,
"totalExecuted":22,
"started":"",
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":332,
"totalDefects":0,
"build":"RCI ",
"name":"Test cycle example",
"totalFolders":0,
"projectId":10101,
"createdByDisplay":"Arnaldo Ramirez",
"startDate":"",
"executionSummaries":{
"executionSummary":[
]
}
},
"83":{
"totalExecutions":1,
"totalExecuted":1,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":1,
"totalDefects":0,
"createdBy":"ARamirez",
"name":"test ",
"totalFolders":0,
"modifiedBy":"aramirez",
"projectId":10101,
"createdByDisplay":"Arnaldo Ramirez",
"startDate":"",
"executionSummaries":{
"executionSummary":[
]
}
},
"167":{
"totalExecutions":984,
"endDate":"",
"description":"Test every TC written with a logged in user",
"totalExecuted":34,
"started":"",
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"totalCycleExecutions":984,
"totalDefects":0,
"name":"Full Regression integration",
"totalFolders":0,
"modifiedBy":"pedrogonzalez",
"projectId":10101,
"createdByDisplay":"Pedro Gonzalez",
"executionSummaries":{
"executionSummary":[
]
}
},
"373":{
"totalExecutions":75,
"totalExecuted":2,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":0,
"totalDefects":0,
"name":"CORE-Commerce: Regression",
"totalFolders":4,
"modifiedBy":"jguerra",
"projectId":10101,
"createdByDisplay":"Jandry Guerra",
"startDate":"",
"executionSummaries":{
"executionSummary":[
]
}
},
"891":{
"totalExecutions":174,
"endDate":"",
"description":"",
"totalExecuted":0,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"totalCycleExecutions":174,
"totalDefects":0,
"name":"RCL - Silver - Test Automated Regression (Android)",
"totalFolders":0,
"modifiedBy":"aramirez",
"projectId":10101,
"createdByDisplay":"Arnaldo Ramirez",
"executionSummaries":{
"executionSummary":[
]
}
},
"892":{
"totalExecutions":184,
"totalExecuted":0,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"totalCycleExecutions":184,
"totalDefects":0,
"build":"",
"createdBy":"ARamirez",
"ended":"",
"name":"RCL - Silver - Test Automated Regression (iOS)",
"totalFolders":0,
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"1219":{
"totalExecutions":99,
"endDate":"",
"description":"AEM-Regression",
"totalExecuted":0,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"totalCycleExecutions":99,
"totalDefects":0,
"build":"",
"createdBy":"DGhodke",
"ended":"",
"name":"AEM-Regression",
"totalFolders":0,
"modifiedBy":"dghodke",
"projectId":10101,
"createdByDisplay":"Dhananjay Ghodke",
"startDate":"",
"executionSummaries":{
"executionSummary":[
]
}
},
"1281":{
"totalExecutions":69,
"description":"AEM-Content",
"totalExecuted":0,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":69,
"totalDefects":0,
"name":"AEM-Content",
"totalFolders":0,
"modifiedBy":"dghodke",
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"1282":{
"totalExecutions":37,
"totalExecuted":0,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":37,
"totalDefects":0,
"createdBy":"DGhodke",
"name":"AEM-Integration",
"totalFolders":0,
"modifiedBy":"dghodke",
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"1465":{
"totalExecutions":0,
"totalExecuted":0,
"started":"",
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":0,
"totalDefects":0,
"name":"Motley Crew",
"totalFolders":2,
"modifiedBy":"jwalker-clay",
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"1656":{
"totalExecutions":102,
"totalExecuted":0,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":0,
"totalDefects":0,
"createdBy":"ARamirez",
"name":"CORE - Regression 2.0",
"totalFolders":6,
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"1739":{
"totalExecutions":42,
"totalExecuted":22,
"versionName":"Unscheduled",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":42,
"totalDefects":0,
"build":"",
"createdBy":"KVonStorch",
"ended":"",
"name":"LaunchDarkly Test Cycle",
"totalFolders":0,
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"2340":{
"totalExecutions":42,
"totalExecuted":0,
"started":"",
"versionName":"Unscheduled",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":42,
"totalDefects":0,
"build":"",
"createdBy":"AndrewWhite",
"ended":"",
"name":"LaunchDarkly Test Cycle- Build Blocks",
"totalFolders":0,
"modifiedBy":"andrewwhite",
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"2422":{
"totalExecutions":25,
"endDate":"16/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":25,
"started":"true",
"versionName":"Unscheduled",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":25,
"totalDefects":0,
"build":"",
"createdBy":"apiagent",
"ended":"true",
"name":"AEM Automation-ZAPI",
"totalFolders":0,
"modifiedBy":"apiagent",
"projectId":10101,
"createdByDisplay":"APIagent",
"startDate":"16/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"2423":{
"totalExecutions":0,
"endDate":"16/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":0,
"started":"true",
"versionName":"Unscheduled",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":0,
"totalDefects":0,
"build":"",
"createdBy":"apiagent",
"ended":"true",
"name":"AEM Automation-ZAPI",
"totalFolders":0,
"modifiedBy":"apiagent",
"projectId":10101,
"createdByDisplay":"APIagent",
"startDate":"16/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"2424":{
"totalExecutions":25,
"endDate":"16/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":25,
"started":"true",
"versionName":"Unscheduled",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":25,
"totalDefects":0,
"build":"",
"createdBy":"apiagent",
"ended":"true",
"name":"AEM Automation-ZAPI",
"totalFolders":0,
"modifiedBy":"apiagent",
"projectId":10101,
"createdByDisplay":"APIagent",
"startDate":"16/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"2434":{
"totalExecutions":157,
"endDate":"17/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":157,
"started":"true",
"versionName":"Unscheduled",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":157,
"totalDefects":0,
"build":"",
"createdBy":"apiagent",
"ended":"true",
"name":"RCL - ZAPI - Test Automated Regression (iOS)",
"totalFolders":0,
"modifiedBy":"apiagent",
"projectId":10101,
"createdByDisplay":"APIagent",
"startDate":"17/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"2436":{
"totalExecutions":163,
"endDate":"17/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":163,
"versionName":"Unscheduled",
"projectKey":"CORE",
"versionId":-1,
"environment":"",
"totalCycleExecutions":163,
"totalDefects":0,
"build":"",
"createdBy":"apiagent",
"ended":"true",
"name":"RCI Silver & Gold - 1.10 -Test Automated Regression (Android)",
"totalFolders":0,
"projectId":10101,
"startDate":"17/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"recordsCount":20
}
],
"10001":[],
"14074":[
{
"-1":{
"totalExecutions":0,
"totalExecuted":0,
"started":"",
"versionName":"Excalibur 1.9.1",
"projectKey":"CORE",
"versionId":14074,
"environment":"",
"totalCycleExecutions":0,
"name":"Ad hoc",
"projectId":10101,
"executionSummaries":{
"executionSummary":[
]
}
},
"2400":{
"totalExecutions":166,
"endDate":"14/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":166,
"started":"true",
"versionName":"Excalibur 1.9.1",
"projectKey":"CORE",
"versionId":14074,
"environment":"",
"totalCycleExecutions":166,
"totalDefects":0,
"createdBy":"apiagent",
"ended":"true",
"name":"RCI Silver & Gold - 1.9.1 -Test Automated Regression (Android)",
"totalFolders":0,
"modifiedBy":"mparra",
"projectId":10101,
"createdByDisplay":"APIagent",
"startDate":"14/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"2409":{
"totalExecutions":146,
"endDate":"15/Aug/18",
"description":"Create cycle with sprint",
"totalExecuted":146,
"started":"true",
"versionName":"Excalibur 1.9.1",
"expand":"executionSummaries",
"projectKey":"CORE",
"versionId":14074,
"totalCycleExecutions":146,
"totalDefects":0,
"createdBy":"apiagent",
"ended":"true",
"name":"RCI Silver & Gold - 1.9.1 - Test Automated Regression (iOS)",
"totalFolders":0,
"modifiedBy":"mparra",
"projectId":10101,
"startDate":"15/Aug/18",
"executionSummaries":{
"executionSummary":[
]
}
},
"recordsCount":3
}
]
}

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...