Splunk Search

How to merge cells in Splunk

spl10
Explorer

I want to merge the cells in column S.No and share the output to the requestor.

The only ask is Splunk should take all the values seperated in different colours and send three different emails.

Ex    S.No.

1

2

3

4

5

6

7

8

9

10

11

12

I should send emails to 

S.No 

1

4

9Capture.PNG

Capture1.PNG

 

Labels (1)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

You need to mind the basics of posing an answerable question: clearly illustrate data input (in text table), illustrate desired output (also in text unless it is a graphic visualization), and explain the logic in clear language.   It is really unclear what is the relationship between these field values.  

If I have to speculate, Appname, and requestor are always paired, S.No and host are always paired.  Is this correct?  Based on this, I made up the following mock data:

AppnameS.Nohostlogtyperequestorsource
A1ghisomelogabc@def.comsomelog.jkl
A1ghisomelogabc@def.comsomelog.klm
A1ghisomelogabc@def.comsomelog.lmn
B2hijsomelogbcd@efg.comsomelog.klm
B2hijsomelogbcd@efg.comsomelog.jkl
C3ijksomelogcde@fgh.comsomelog.lmn
C3ijksomelogcde@fgh.comsomelog.aaa
A4xyzsomelogabc@def.comsomelog.opq
A4xyzsomelogabc@def.comsomelog.opq
A4xyzsomelogabc@def.comsomelog.bbb
B5wxysomelogbcd@efg.comsomelog.rst
B5wxysomelogbcd@efg.comsomelog.uvw
C6vwxsomelogcde@fgh.comsomelog.uvw
C6vwxsomelogcde@fgh.comsomelog.rst
C6vwxsomelogcde@fgh.comsomelog.opq
A7aaasomelogabc@def.comsomelog.klm
A7aaasomelogabc@def.comsomelog.lmn
A7aaasomelogabc@def.comsomelog.jkl
B8bbbsomelogbcd@efg.comsomelog.klm
C9cccsomelogcde@fgh.comsomelog.lmn
C9cccsomelogcde@fgh.comsomelog.aaa
C9cccsomelogcde@fgh.comsomelog.bbb
A10hijsomelogabc@def.comsomelog.aaa
B11jklsomelogbcd@efg.comsomelog.aaa
B11jklsomelogbcd@efg.comsomelog.bbb
B11jklsomelogbcd@efg.comsomelog.ccc
C12ijksomelogcde@fgh.comsomelog.abc
C12ijksomelogcde@fgh.comsomelog.ccc

As @ITWhisperer says, Splunk is not a spreadsheet.  You cannot have cell merge and such.  But if you really want to simulate the effect, you can do something like this:

 

 

| stats values(source) as source by Appname logtype requestor S.No host
| rename S.No as S_No
| eval source = mvjoin(source, ", ")
| tojson S_No host source
| stats values(_raw) as _raw by Appname requestor logtype
| eval host = mvmap(_raw, spath(_raw, "host"))
| eval S.No = mvmap(_raw, spath(_raw, "S_No"))
| eval source = mvmap(_raw, spath(_raw, "source"))
| table S.No Appname requestor logtype source

 

 

Result from the above mock data is

S.No
Appnamerequestorlogtype
source
1
10
4
7
Aabc@def.comsomelog
somelog.jkl, somelog.klm, somelog.lmn
somelog.aaa
somelog.bbb, somelog.opq
somelog.jkl, somelog.klm, somelog.lmn
11
2
5
8
Bbcd@efg.comsomelog
somelog.aaa, somelog.bbb, somelog.ccc
somelog.jkl, somelog.klm
somelog.rst, somelog.uvw
somelog.klm
12
3
6
9
Ccde@fgh.comsomelog
somelog.abc, somelog.ccc
somelog.aaa, somelog.lmn
somelog.opq, somelog.rst, somelog.uvw
somelog.aaa, somelog.bbb, somelog.lmn

Is this something you are looking for?

Here is mock data emulation:

 

 

| makeresults format=csv data="S.No, requestor, Appname, host, logtype, source
1, abc@def.com, A, ghi, somelog, somelog.jkl
1, abc@def.com, A, ghi, somelog, somelog.klm
1, abc@def.com, A, ghi, somelog, somelog.lmn
2, bcd@efg.com, B, hij, somelog, somelog.klm
2, bcd@efg.com, B, hij, somelog, somelog.jkl
3, cde@fgh.com, C, ijk, somelog, somelog.lmn
3, cde@fgh.com, C, ijk, somelog, somelog.aaa
4, abc@def.com, A, xyz, somelog, somelog.opq
4, abc@def.com, A, xyz, somelog, somelog.opq
4, abc@def.com, A, xyz, somelog, somelog.bbb
5, bcd@efg.com, B, wxy, somelog, somelog.rst
5, bcd@efg.com, B, wxy, somelog, somelog.uvw
6, cde@fgh.com, C, vwx, somelog, somelog.uvw
6, cde@fgh.com, C, vwx, somelog, somelog.rst
6, cde@fgh.com, C, vwx, somelog, somelog.opq
7, abc@def.com, A, aaa, somelog, somelog.klm
7, abc@def.com, A, aaa, somelog, somelog.lmn
7, abc@def.com, A, aaa, somelog, somelog.jkl
8, bcd@efg.com, B, bbb, somelog, somelog.klm
9, cde@fgh.com, C, ccc, somelog, somelog.lmn
9, cde@fgh.com, C, ccc, somelog, somelog.aaa
9, cde@fgh.com, C, ccc, somelog, somelog.bbb
10, abc@def.com, A, hij, somelog, somelog.aaa
11, bcd@efg.com, B, jkl, somelog, somelog.aaa
11, bcd@efg.com, B, jkl, somelog, somelog.bbb
11, bcd@efg.com, B, jkl, somelog, somelog.ccc
12, cde@fgh.com, C, ijk, somelog, somelog.abc
12, cde@fgh.com, C, ijk, somelog, somelog.ccc"
``` data emulation above ```

 

View solution in original post

yuanliu
SplunkTrust
SplunkTrust

You need to mind the basics of posing an answerable question: clearly illustrate data input (in text table), illustrate desired output (also in text unless it is a graphic visualization), and explain the logic in clear language.   It is really unclear what is the relationship between these field values.  

If I have to speculate, Appname, and requestor are always paired, S.No and host are always paired.  Is this correct?  Based on this, I made up the following mock data:

AppnameS.Nohostlogtyperequestorsource
A1ghisomelogabc@def.comsomelog.jkl
A1ghisomelogabc@def.comsomelog.klm
A1ghisomelogabc@def.comsomelog.lmn
B2hijsomelogbcd@efg.comsomelog.klm
B2hijsomelogbcd@efg.comsomelog.jkl
C3ijksomelogcde@fgh.comsomelog.lmn
C3ijksomelogcde@fgh.comsomelog.aaa
A4xyzsomelogabc@def.comsomelog.opq
A4xyzsomelogabc@def.comsomelog.opq
A4xyzsomelogabc@def.comsomelog.bbb
B5wxysomelogbcd@efg.comsomelog.rst
B5wxysomelogbcd@efg.comsomelog.uvw
C6vwxsomelogcde@fgh.comsomelog.uvw
C6vwxsomelogcde@fgh.comsomelog.rst
C6vwxsomelogcde@fgh.comsomelog.opq
A7aaasomelogabc@def.comsomelog.klm
A7aaasomelogabc@def.comsomelog.lmn
A7aaasomelogabc@def.comsomelog.jkl
B8bbbsomelogbcd@efg.comsomelog.klm
C9cccsomelogcde@fgh.comsomelog.lmn
C9cccsomelogcde@fgh.comsomelog.aaa
C9cccsomelogcde@fgh.comsomelog.bbb
A10hijsomelogabc@def.comsomelog.aaa
B11jklsomelogbcd@efg.comsomelog.aaa
B11jklsomelogbcd@efg.comsomelog.bbb
B11jklsomelogbcd@efg.comsomelog.ccc
C12ijksomelogcde@fgh.comsomelog.abc
C12ijksomelogcde@fgh.comsomelog.ccc

As @ITWhisperer says, Splunk is not a spreadsheet.  You cannot have cell merge and such.  But if you really want to simulate the effect, you can do something like this:

 

 

| stats values(source) as source by Appname logtype requestor S.No host
| rename S.No as S_No
| eval source = mvjoin(source, ", ")
| tojson S_No host source
| stats values(_raw) as _raw by Appname requestor logtype
| eval host = mvmap(_raw, spath(_raw, "host"))
| eval S.No = mvmap(_raw, spath(_raw, "S_No"))
| eval source = mvmap(_raw, spath(_raw, "source"))
| table S.No Appname requestor logtype source

 

 

Result from the above mock data is

S.No
Appnamerequestorlogtype
source
1
10
4
7
Aabc@def.comsomelog
somelog.jkl, somelog.klm, somelog.lmn
somelog.aaa
somelog.bbb, somelog.opq
somelog.jkl, somelog.klm, somelog.lmn
11
2
5
8
Bbcd@efg.comsomelog
somelog.aaa, somelog.bbb, somelog.ccc
somelog.jkl, somelog.klm
somelog.rst, somelog.uvw
somelog.klm
12
3
6
9
Ccde@fgh.comsomelog
somelog.abc, somelog.ccc
somelog.aaa, somelog.lmn
somelog.opq, somelog.rst, somelog.uvw
somelog.aaa, somelog.bbb, somelog.lmn

Is this something you are looking for?

Here is mock data emulation:

 

 

| makeresults format=csv data="S.No, requestor, Appname, host, logtype, source
1, abc@def.com, A, ghi, somelog, somelog.jkl
1, abc@def.com, A, ghi, somelog, somelog.klm
1, abc@def.com, A, ghi, somelog, somelog.lmn
2, bcd@efg.com, B, hij, somelog, somelog.klm
2, bcd@efg.com, B, hij, somelog, somelog.jkl
3, cde@fgh.com, C, ijk, somelog, somelog.lmn
3, cde@fgh.com, C, ijk, somelog, somelog.aaa
4, abc@def.com, A, xyz, somelog, somelog.opq
4, abc@def.com, A, xyz, somelog, somelog.opq
4, abc@def.com, A, xyz, somelog, somelog.bbb
5, bcd@efg.com, B, wxy, somelog, somelog.rst
5, bcd@efg.com, B, wxy, somelog, somelog.uvw
6, cde@fgh.com, C, vwx, somelog, somelog.uvw
6, cde@fgh.com, C, vwx, somelog, somelog.rst
6, cde@fgh.com, C, vwx, somelog, somelog.opq
7, abc@def.com, A, aaa, somelog, somelog.klm
7, abc@def.com, A, aaa, somelog, somelog.lmn
7, abc@def.com, A, aaa, somelog, somelog.jkl
8, bcd@efg.com, B, bbb, somelog, somelog.klm
9, cde@fgh.com, C, ccc, somelog, somelog.lmn
9, cde@fgh.com, C, ccc, somelog, somelog.aaa
9, cde@fgh.com, C, ccc, somelog, somelog.bbb
10, abc@def.com, A, hij, somelog, somelog.aaa
11, bcd@efg.com, B, jkl, somelog, somelog.aaa
11, bcd@efg.com, B, jkl, somelog, somelog.bbb
11, bcd@efg.com, B, jkl, somelog, somelog.ccc
12, cde@fgh.com, C, ijk, somelog, somelog.abc
12, cde@fgh.com, C, ijk, somelog, somelog.ccc"
``` data emulation above ```

 

spl10
Explorer

Thank you so for the responses @bowesmana @ITWhisperer and a special thanks to @yuanliu.

I really apologize for posting the requirement in an unclear manner, I was extremely fatigued yet desperately needed to find the solution.

Honestly saying I wasn't confident that I would receive the response so quickly and precise.

I sincerely appreciate the community and individuals like you make this as a wonderful forum for discussion.

To be part of this community is an honor.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Splunk is not a spreadsheet, having said that you can use the stats command to "merge cells"

| stats min('S No') as "S No" list(*) as * by Appname
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Before this stats command also add this

| filldown Appname

so that empty Appname rows will adopt the name from above

0 Karma
Get Updates on the Splunk Community!

Transforming Financial Data into Fraud Intelligence

Every day, banks and financial companies handle millions of transactions, logins, and customer interactions ...

How to send events & findings from AWS to Splunk using Amazon EventBridge

Amazon EventBridge is a serverless service that uses events to connect application components together, making ...

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...