Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Advanced Splunk

You're reading from   Advanced Splunk Master the art of getting the maximum out of your machine data using Splunk

Arrow left icon
Product type Paperback
Published in Jun 2016
Publisher
ISBN-13 9781785884351
Length 348 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Ashish Kumar Tulsiram Yadav Ashish Kumar Tulsiram Yadav
Author Profile Icon Ashish Kumar Tulsiram Yadav
Ashish Kumar Tulsiram Yadav
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. What's New in Splunk 6.3? FREE CHAPTER 2. Developing an Application on Splunk 3. On-boarding Data in Splunk 4. Data Analytics 5. Advanced Data Analytics 6. Visualization 7. Advanced Visualization 8. Dashboard Customization 9. Advanced Dashboard Customization 10. Tweaking Splunk 11. Enterprise Integration with Splunk 12. What Next? Splunk 6.4 Index

The Splunk SDK for Python

We understood the use of an SDK and also saw the installation part of the Splunk SDK for Python. Now, we will see how the SDK can be used to integrate the power of Splunk's analytics and visualization.

Importing the Splunk API in Python

The following import statement will make the Splunk API available for use in Python:

import splunklib.client as client
import splunklib.results as results

The preceding two import statements make the API exposed using the Splunk SDK that is to be used in the Python code for integration.

Connecting and authenticating the Splunk server

The following image in the code snippet connects and also authenticates the Splunk server. The login details can be passed as a parameter when running the Python code or can be hardcoded in the code itself and can be saved in a .splunkrc file:

Connecting and authenticating the Splunk server

Once the authentication is successful, the Splunk APIs can be used to send data on Splunk, enlist or run saved searches, run a search query on Splunk, upload files...

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 $19.99/month. Cancel anytime
Banner background image