|
Hey Splunkers, I cannot get the following rex statement to match in Splunk. I read that using (?m) in the transforms.conf file will match multiline events however I am having trouble getting this to work at searchtime. Actually, I dont even know if this will work at search time.
Please let me know if this would work... Regardless, we have events that have a field of "Account Name". After which, there is another "Account Name" that isn't being made into a field. The data after the second Account Name is what we are trying to grab. Example:
Any better ideas on how to do this? Thanks in advance! I-Man |
|
You can do exactly that with mvindex. This function allows you to pick which value of a multi-valued field you would like to take. I'll show a search using -1 as the index value, since this will always pick the last value. Using the following search will take the last "Account_Name" and place it in a field called user for each event:
Cheers, P.S. If you want to verify that the user field is picking up the correct values, try this search which will list the Account_Name(s) and user fields side-by-side:
Exactly what I was looking for. Thanks ron!!!
(10 Feb '11, 13:25)
I-Man
|
|
If you have the Windows app installed, Splunk should automagically extract both account names from the log entries. Select Account_Name in the "Pick Fields" and search for something like this:
You'll notice that under each event that has multiple account names, you'll see both entries:
You don't need the (?m). The RegEx was not correct prior to being edited, but you shouldn't need to use one. Cheers Thanks much for the response ron. Is there anyway to only grab the second account name and ignore the first instance?
(09 Feb '11, 13:09)
I-Man
|
