- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ss394546910
Engager
10-07-2022
01:28 PM
Splunk logs looks like below:
userid=234user|rwe23|dwdwd --
userid=id123|34lod|2323 textHow can I get value between "=" and first "|"
I want to get table of value between "=" and first "|", like "234user" and "id123"
I tried:
index=indexhere "userid=" |regex "(?<==)(?<info>.+?)(?=\|)"
| dedup info
| table info
this one works fine in regex101, but shows 0 result in Splunk.
Could anyone please help? Any help would be appreciated. Thanks!
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yuanliu

SplunkTrust
10-07-2022
02:11 PM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yuanliu

SplunkTrust
10-07-2022
02:11 PM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ss394546910
Engager
10-07-2022
02:38 PM
Yes..seems like I am looking for rex not regex. Thanks for helping.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

richgalloway

SplunkTrust
10-07-2022
02:10 PM
The regex command filters events - it does not extract fields. To extract fields, use the rex command. Also, avoid lookbehind in regexes - they're not necessary and take longer to process.
index=indexhere "userid="
| rex "userid=(?<info>[^\|]+?)"
| dedup info
| table info
---
If this reply helps you, Karma would be appreciated.
If this reply helps you, Karma would be appreciated.
