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!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...