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!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...