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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...