Hello I have this query : index="github_runners" sourcetype="testing" source="reports-tests"
| spath path=libraryPath output=library
| spath path=result.69991058{} output=testResult
| mvexpand testResult
| spath input=testResult path=fullName output=test_name
| spath input=testResult path=success output=test_outcome
| spath input=testResult path=skipped output=test_skipped
| spath input=testResult path=time output=test_time
| table library testResult test_name test_outcome test_skipped test_time
| eval status=if(test_outcome="true", "Passed", if(test_outcome="false", "Failed", if(test_skipped="true", "NotExecuted", "")))
| stats count sum(eval(if(status="Passed", 1, 0))) as passed_tests, sum(eval(if(status="Failed", 1, 0))) as failed_tests , sum(eval(if(status="NotExecuted", 1, 0))) as test_skipped by test_name library test_time
| eval total_tests = passed_tests + failed_tests
| eval success_ratio=round((passed_tests/total_tests)*100,2)
| table library, test_name, total_tests, passed_tests, failed_tests, test_skipped, success_ratio test_time
| sort + success_ratio And i'm trying to make its dynamic so i will see results for other numbers than '69991058' How can i make it ? i'm trying with regex but it looks like im doing something wrong since im getting 0 results while in the first query there are results index="github_runners" sourcetype="testing" source="reports-tests"
| spath path=libraryPath output=library
| rex field=_raw "result\.(?<number>\d+)\{\}"
| spath path="result.number{}" output=testResult
| mvexpand testResult
| spath input=testResult path=fullName output=test_name
| spath input=testResult path=success output=test_outcome
| spath input=testResult path=skipped output=test_skipped
| spath input=testResult path=time output=test_time
| table library testResult test_name test_outcome test_skipped test_time
| eval status=if(test_outcome="true", "Passed", if(test_outcome="false", "Failed", if(test_skipped="true", "NotExecuted", "")))
| stats count sum(eval(if(status="Passed", 1, 0))) as passed_tests, sum(eval(if(status="Failed", 1, 0))) as failed_tests , sum(eval(if(status="NotExecuted", 1, 0))) as test_skipped by test_name library test_time
| eval total_tests = passed_tests + failed_tests
| eval success_ratio=round((passed_tests/total_tests)*100,2)
| table library, test_name, total_tests, passed_tests, failed_tests, test_skipped, success_ratio test_time
| sort + success_ratio
... View more