- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
madakkas
Explorer
04-24-2018
08:20 PM
I have the below sample data
Groups Values
G1 1
G1 2
G1 1
G1 2
G3 3
G3 3
G3 3
I am looking to sum up the values field grouped by the Groups and have it displayed as below .
Groups Values Sum
G1 1 8
G1 5 8
G1 1 8
G1 1 8
G3 3 9
G3 3 9
G3 3 9
the reason is that i need to eventually develop a scorecard model from each of the Groups and other variables in each row. All help is appreciated.
thank You to all the splunk gurus here.
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
p_gurav
Champion
04-24-2018
09:03 PM
Can you try somethins:
| makeresults | eval abc="G1 1,G1 5,G1 1,G1 1,G3 3,G3 3,G3 3" | makemv delim="," abc | mvexpand abc | rex field=abc "(?P<Group>[^\s]+)\s(?P<Value>.+)" | stats sum(Value) list(Value) AS abc1 by Group | mvexpand abc1
OR
| makeresults | eval abc="G1 1 G1 5 G1 1 G1 1 G3 3 G3 3 G3 3" | rex field=abc max_match=0 "(?P<Group>[^\s]+)\s(?P<Value>[^\s]+)" | eval ab=mvzip(Group,Value) | mvexpand ab | rex field=ab max_match=0 "(?P<Group>[^,]+),(?P<Value>.+)" | stats sum(Value) AS Sum list(Value) AS Value by Group | mvexpand Value
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
TISKAR
Builder
04-24-2018
11:17 PM
@madakkas, Can youu try this please:
<yourBaseSearch>| eventstats sum(Value) by Group
For Example:
| makeresults | eval abc="G1 1 G1 5 G1 1 G1 1 G3 3 G3 3 G3 3" | rex field=abc max_match=0 "(?P<Group>[^\s]+)\s(?P<Value>[^\s]+)" | eval ab=mvzip(Group,Value) | mvexpand ab | rex field=ab max_match=0 "(?P<Group>[^,]+),(?P<Value>.+)" | eventstats sum(Value) as sum by Group
| fields Group Value sum
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

woodcock
Esteemed Legend
04-24-2018
09:24 PM
What do your raw events (fields) look like?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
madakkas
Explorer
04-24-2018
10:32 PM
Raw Events are in a csv file
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
p_gurav
Champion
04-24-2018
09:03 PM
Can you try somethins:
| makeresults | eval abc="G1 1,G1 5,G1 1,G1 1,G3 3,G3 3,G3 3" | makemv delim="," abc | mvexpand abc | rex field=abc "(?P<Group>[^\s]+)\s(?P<Value>.+)" | stats sum(Value) list(Value) AS abc1 by Group | mvexpand abc1
OR
| makeresults | eval abc="G1 1 G1 5 G1 1 G1 1 G3 3 G3 3 G3 3" | rex field=abc max_match=0 "(?P<Group>[^\s]+)\s(?P<Value>[^\s]+)" | eval ab=mvzip(Group,Value) | mvexpand ab | rex field=ab max_match=0 "(?P<Group>[^,]+),(?P<Value>.+)" | stats sum(Value) AS Sum list(Value) AS Value by Group | mvexpand Value
