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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...