Splunk Search

How to make from one row two?

andrey2007
Contributor

Hello All
My table looks like these

Number Name Position Login1 Login2

1 John expert johns1 johns2

is it possible to make another table which looks like
Number Name Position Login
1 John expert johns1
2 John expert johns2

Thanks for all answers!

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

If you have just two fields you can do this:

base search | eval Login = Login1."###".Login2 | fields - Login1 Login2 | makemv delim="###" Login | mvexpand Login

View solution in original post

krish3
Contributor

try using transpose to your result..

....your search |table....|transpose
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If you have just two fields you can do this:

base search | eval Login = Login1."###".Login2 | fields - Login1 Login2 | makemv delim="###" Login | mvexpand Login

martin_mueller
SplunkTrust
SplunkTrust

You could insert this:

... | fillnull value="n/a" Login1 Login2 | ...
0 Karma

andrey2007
Contributor

and it does not work for case like this user has only Login1 OR Login2
Number Name Position Login1 Login2

1 John expert johns2
2 Willy expert will1

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Huh? How does it work and throw an error message at the same time?

0 Karma

andrey2007
Contributor

Thanks, it works!
But with message like this
Field 'Login' does not exist in the data.

0 Karma

treinke
Builder

Maybe something like this?

<your search> | rename Login1 as Login | rename Login2 as Login | sort by Login | table Number,Name,Position,Login
There are no answer without questions
0 Karma

andrey2007
Contributor

sorry, but not
this way table looks like
Number Name Position Login2

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...