Splunk Search

data types

rcbutterfield
Explorer

How can you query an index to find out the data types of the fields and any attributes that describe the field?  from a data governance perspective to document.  Apologies... new to this...  I know that you can query the index and fields would be listed and see some of the metadata type info but it's not exportable..i  would like to query and export that info.  thx

 

Labels (1)
0 Karma
1 Solution

livehybrid
SplunkTrust
SplunkTrust

Hi @rcbutterfield 

This might work for you - this works by taking the latest value of each field for each sourcetype in the initial query and then performing a "typeof" command to determine the type.

Update the first line accordingly:

index=_internal | head 100
| stats latest(*) AS * by sourcetype
| foreach * [|eval fieldInfo=mvappend(fieldInfo,"<<FIELD>>=".typeof(<<FIELD>>))]
| stats values(fieldInfo) by sourcetype

 

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

 

View solution in original post

0 Karma

rcbutterfield
Explorer

Thank you.... yes, that worked and will give me something to work with.   Much appreciated!

0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @rcbutterfield 

This might work for you - this works by taking the latest value of each field for each sourcetype in the initial query and then performing a "typeof" command to determine the type.

Update the first line accordingly:

index=_internal | head 100
| stats latest(*) AS * by sourcetype
| foreach * [|eval fieldInfo=mvappend(fieldInfo,"<<FIELD>>=".typeof(<<FIELD>>))]
| stats values(fieldInfo) by sourcetype

 

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

 

0 Karma
Get Updates on the Splunk Community!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Your Voice Matters! Help Us Shape the New Splunk Lantern Experience

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

Building Momentum: Splunk Developer Program at .conf25

At Splunk, developers are at the heart of innovation. That’s why this year at .conf25, we officially launched ...