RegexCapture Action No Match #161
-
Hello, I'm running into issues with the Here's an example I built out for a sanity check: <?xml version="1.0" encoding="UTF-8" ?>
<Workflow name="GitHub Audit" version="1.0" xmlns="http://qradar.ibm.com/UniversalCloudRESTAPI/Workflow/V1">
<Actions>
<Log type="INFO" message="regex no match test" />
<RegexCapture pattern="NO_MATCH" value="hello world" savePath="/regex_output" />
<Log type="INFO" message="after regex" />
</Actions>
</Workflow> When I run that workflow in our QRadar instance I only see the following entry in the log
So the log statement after the My actual use case: I'm making requests for events from the GitHub audit log API. If there are multiple pages of events, the link for the next page of events is returned in a 'Link' response header. However, there is other data in this header as well, so I need to parse the URL out with regex to use it in my next request. When I get to the last page of events, the Link header will no longer have the URL for the next page. This is when the regex doesn't match and I run into the error. Here's an example of the 'Link' header value for the first page of events:
I need to parse Here's an example of the 'Link' header value for the second page of events (more data than just the 'next' URL - 'next', 'first', and 'prev' links):
Finally, here's an example of the 'Link header for the last page of events (no 'next' URL so regex pattern doesn't match):
I was thinking it might make sense to check if "next" is in the header value before trying to parse the URL with regex, but I'm also struggling to figure out how to do this with any of the JPath functions. Is the Any help would be greatly appreciated! I'm running this on an instance of QRadar that's on version
I'm not a QRadar expert, so please hold my hand if you notice anything. I typically working within the IBM SOAR platform but I have been tasked with creating a Universal REST API log source. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
In case anyone stumbles on this, I ended up splitting the value by commas and then using a regex pattern that was guaranteed to match. In the context of my issue it would split the 'Link' header so then I would have a list of Link URLs. The Regex pattern would then parse out the 'type' of the link (next, last, first) and iterate over them. if the 'next' link was found the URL is parsed out of it and used in the next request. I think allowing |
Beta Was this translation helpful? Give feedback.
-
The https://www.ibm.com/docs/en/dsm?topic=actions-regexcapture Changing the regex to
Vs the output with just
So that might have been the cause of your issue! So the regex can fail to match, and the value saved to the path will just be empty
|
Beta Was this translation helpful? Give feedback.
The
RegexCapture
action does require at least one capture group.https://www.ibm.com/docs/en/dsm?topic=actions-regexcapture
Changing the regex to
"(NO MATCH)"
instead doesn't abort it with an ExceptionVs the output with just
"NO MATCH"