Windows Logs: Ignore Spaces In Target Text?
Regex noob here. I am searching through Windows Security Event Logs trying to extract values. I have found that the regex syntax I am using only returns values when the target text does not contain a space. How do I configure the regex syntax to grab all characters/words regardless if there is a space?
Search line:
| parse regex "Target Account Name:\s+(?<Group\_Name>\S+)+\r\n\r\n." nodrop
Examples:
Failure:
Target Account Name: Windows Vision-Group (the resulting "group_name" field is blank when the search is run)
Success:
Target Account Name: Windows-Vision-Group (the resulting "group_name" field contains "Windows-Vision-Group")
-
Hi Mike, try this regex:
| parse regex "Target Account Name:[\s&&[^\r]]+(?<group\_name>[^\r]+?)\r"
What you are doing here is making sure that you are capturing only those entries that have an actual group name (i.e. where the field is not blank) and then while capturing the group_name you make sure that you capture only the non-carriage return characters. Hope that helps, Rishi.
Please sign in to leave a comment.
Comments
3 comments