Splunk Search

Swap field and values

muebel
SplunkTrust
SplunkTrust

I have a list of fields within a Datamodel collected as values within the field named "unknown"

| datamodel Authentication Authentication 
| table * 
| spath 
| table fields{}.displayName 
| rename fields{}.displayName as unknown 
| mvexpand unknown

This gives:
alt text

I'd like to extend this search to give me a table with fields "dest_bunit", "dest_category" etc, all with a value of "unknown"

Ultimately this would be used as a subsearch within tstats to find events that have unknown values for any of the values within the datamodel.

More straightforward (and equally dynamic) would probably serve as an answer to this as well.

Tags (3)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

| datamodel Authentication Authentication 
 | table * 
 | spath 
 | table fields{}.displayName 
 | rename fields{}.displayName as unknown 
 | mvexpand unknown | eval temp=1 | eval data="unknown" | xyseries temp unknown data | fields - temp

View solution in original post

somesoni2
Revered Legend

Try like this

| datamodel Authentication Authentication 
 | table * 
 | spath 
 | table fields{}.displayName 
 | rename fields{}.displayName as unknown 
 | mvexpand unknown | eval temp=1 | eval data="unknown" | xyseries temp unknown data | fields - temp

muebel
SplunkTrust
SplunkTrust

I had thought that xyseries and/or untable had something to do with the solution. I need to understand those commands better. Thanks!

0 Karma
Get Updates on the Splunk Community!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...