Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Implementing Splunk 7, Third Edition - Third Edition

You're reading from  Implementing Splunk 7, Third Edition - Third Edition

Product type Book
Published in Mar 2018
Publisher Packt
ISBN-13 9781788836289
Pages 576 pages
Edition 3rd Edition
Languages

Table of Contents (19) Chapters

Title Page
Packt Upsell
Contributors
Preface
The Splunk Interface Understanding Search Tables, Charts, and Fields Data Models and Pivots Simple XML Dashboards Advanced Search Examples Extending Search Working with Apps Building Advanced Dashboards Summary Indexes and CSV Files Configuring Splunk Advanced Deployments Extending Splunk Machine Learning Toolkit Index

Using CSV files to store transient data


Sometimes it is useful to store small amounts of data outside a Splunk index. Using the inputcsv and outputcsv commands, we can store tabular data in CSV files on the filesystem.

Pre-populating a dropdown

If a dashboard contains a dynamic dropdown, you must use a search to populate the dropdown. As the amount of data increases, the query to populate the dropdown will run more and more slowly, even from a summary index. We can use a CSV file to store just the information needed, simply adding new values when they occur.

First, we build a query to generate the CSV file. This query should be run over as much data as possible:

source="impl_splunk_gen" 
| stats count by user 
| outputcsv user_list.csv 

Next, we need a query to run periodically and append any new entries to the file. Schedule this query to run periodically as a saved search:

source="impl_splunk_gen" 
| stats count by user 
| append [inputcsv user_list.csv] 
| stats sum(count) as count by user...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}