Hi,
How do I write a regex to capture whenever I see any combination of 10 digits followed by .zip within a _raw event?
eg:
url=www.abcdef.com/1234532419.zip
Thanks.
Like this:
... | rex field=url mode=sed "s/\.zip//"
Try like
| rex field=url "\/(?P<result>\d{10}.zip)"
ah yeh, how would I capture the whole URL though in the new result field? rather than just the 6 digits?
what is your expected result?
Expected result is the full URL listed, but to only pull back URL's that match the regex, i.e. 10 digits followed by .zip
Check this rex (?P<result>url=\S+\/\d{10}.zip)
Perfect. Many thanks 🙂
@jacqu3sy
Try this:
YOUR SEARCH | rex field=url "(?<data>\d.*).zip"
Sample
|makeresults | eval url="www.abcdef.com/1234532419.zip" | rex field=url "(?<data>\d.*).zip"
ah yeh, how would I capture the whole URL though in the new data field? rather than just the 6 digits?