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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...