Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Splunk Developer's Guide, Second Edition
Splunk Developer's Guide, Second Edition

Splunk Developer's Guide, Second Edition: Learn the A to Z of building excellent Splunk applications with the latest techniques using this comprehensive guide , Second Edition

eBook
$9.99 $39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Splunk Developer's Guide, Second Edition

Chapter 2. Creating Applications

In this chapter, we will begin covering how to build an actual application. There are many different ways to create an App, ranging from GUI creation to manual editing of configuration files. We will cover the structure of an application, what each folder should contain within the application, and why this is important. Another aspect that will be touched on will be the data that your application will consume. Setting up the data structures beforehand may save you time and energy later on if you have to refactor. It is crucial to get the data in correctly the first time, as any subsequent release of your app will need to make use of the data. We will cover various methods for data consumption, as well as the types of Splunk knowledge objects that can be included in your application. Restricting access to your application may be a priority, so we will also cover metadata and object permissions. Getting your application installed may require your...

A brief clarification

As we continue to progress through this book, we will create an App from the ground up. The App's name is SDG (from a filesystem perspective) and the App label will be Developer's Guide for Splunk. It will be available in its entirety on Splunkbase at https://splunkbase.splunk.com/app/2693/. Additionally, we will be using an API provided by meh.com, a daily deal site that was kind enough to build an API to their website. They were chosen primarily because they fit the geek culture pretty well, and provide a very simple-to-consume API. The data that will be consumed is pulled from their website's API using scripted inputs located in the bin folder of the sample SDG application.

Let's recall the questions from Chapter 1, Application Design Fundamentals, that revolve around App creation. We should answer some of them in preparation for building our demo App:

  • Identifying the use case:
    • We are building this App as a learning experience for the reader. By...

Methods of creating applications

There are two basic ways of creating applications. They are as follows, in order of difficulty (not that any of them are hard): Splunk Web (we will call this the GUI), and handwritten (henceforth to be recognized as FreeForm). In order to create Apps, you, the developer, must have specific permissions within the Splunk instance.

Tip

Pro tip

Set up a brand new instance of Splunk with a dev license to make sure that you have all the proper permissions to develop an App.

For the GUI method, the user must be an admin within Splunk; additionally, for the FreeForm method, the user must have server access to the command line with as many permissions as required by the user that runs Splunk.

GUI

We will start with the GUI method. This is the simplest of the methods, since access to this feature can be granted via an external authentication system (if authorization is configured within the Splunk instance), or with the built-in role-based access measures. The first step...

Basic application structure

Now that the App has been created, let's take a look at some of the folders that were created, what they may contain, and how they are used with the App. The folders we are going to look at come from the App that was created via Splunk Web.

appserver

The appserver folder contains configurations and other files that relate to some of the inner-workings of the App. In extremely advanced Apps, additional modules and MVC controllers (controllers provide the link between you and the system) are inserted into this folder. For the purpose of this book, we will focus on the static directory, which contains the JavaScript, CSS, and other assets required by the App.

bin

The bin folder contains binary assets, such as those used for modular inputs, scripted inputs, or custom commands. These are most likely Python files, shell scripts, or PowerShell scripts.

default

The default folder contains all the App publisher's configurations and views. When packaging Apps for publishing...

Application data

Now that we have created a new App, we can start working on how we need our data indexed. Typical Apps may contain configurations for their own indexes, source types, and other input methods.

Indexes

Indexes are very useful in a new App as they allow you to physically separate the data on the disk on the indexers. This helps speed up searches and optimizes macros and event types, since only a smaller subset of data will be searched within the App. The configurations of the indexes are in the indexes.conf file, in the default folder. For our App, let's add an index. The configuration looks like this in the indexes.conf file, located at $APP_HOME/default/indexes.conf:

[splunk_developers_guide]
coldPath = $SPLUNK_DB\splunk_developers_guide\colddb
homePath = $SPLUNK_DB\splunk_developers_guide\db
thawedPath = $SPLUNK_DB\splunk_developers_guide\thaweddb

That's it! Defining indexes is a quick way of optimizing your App's data. You can also create indexes using the GUI...

Available Splunk knowledge objects

There are many different Splunk knowledge objects (SKOs) that can be used within an App. The only required SKO for an App is the addition of views that can be displayed to the end user. We will briefly cover the different types of SKOs that you can include within your App. To avoid any issues with author interpretation of the definitions of these SKOs, we will use the definitions and references from the official Splunk documentation.

Macros

noun

A parameterized portion of a search such as an eval statement or a search term that can be reused in multiple places, including saved and ad hoc searches, and which is used in a manner similar to a search command. Search macros can contain arguments, but they are not required.

Macros are configured through the Advanced Configuration section of the GUI, or via the macros.conf file located within the App. They are advantageous by allowing bits of SPL...

Object permissions

Object permissions are an integral part of securing Apps and their knowledge objects. After all, we don't want the user causing issues in an App you spent hours tweaking, do we? No, that's what I thought. This is where permissions come into play. Splunk permissions are role-based, meaning that a user needs a specific role (either assigned by Splunk or via external authentication and authorization systems) to read or write the knowledge object. Permissions are controlled within the default.meta and local.meta files in your metadata folder in the App, and, as per normal Splunk precedence, the local.meta file will override any setting with a matching stanza in the default.meta file.

The configuration structure within the corresponding file is as follows:

[<object_type>/<object_name>]
access = read : [ <comma-separated list of roles>], write : [ comma-separated list of roles>]

Note

This structure is taken from http://docs.splunk.com/Documentation...

Summary

In this chapter, we looked at a few different methods of creating Splunk Apps. There are two basic methods of creating Apps: via the Web and via the CLI. We looked at the structure of the App and what each folder may contain. We also covered what kinds of objects (in a non-exhaustive list) can be included in a Splunk App. We discussed permissions, and how to assign them in two different ways. We then went over how to set up a REST endpoint to control configuration, as well as a setup screen to allow the user to update credentials within the App.

Up next, we will discuss the different aspects of enhancing your App with event types, workflows, and some acceleration techniques.

Left arrow icon Right arrow icon

Key benefits

  • This is the most up-to-date book on Splunk 6.3 for developers
  • Get ahead of being just a Splunk user and start creating custom Splunk applications as per your needs
  • Your one-stop-solution to Splunk application development

Description

Splunk provides a platform that allows you to search data stored on a machine, analyze it, and visualize the analyzed data to make informed decisions. The adoption of Splunk in enterprises is huge, and it has a wide range of customers right from Adobe to Dominos. Using the Splunk platform as a user is one thing, but customizing this platform and creating applications specific to your needs takes more than basic knowledge of the platform. This book will dive into developing Splunk applications that cater to your needs of making sense of data and will let you visualize this data with the help of stunning dashboards. This book includes everything on developing a full-fledged Splunk application?right from designing to implementing to publishing. We will design the fundamentals to build a Splunk application and then move on to creating one. During the course of the book, we will cover application data, objects, permissions, and more. After this, we will show you how to enhance the application, including branding, workflows, and enriched data. Views, dashboards, and web frameworks are also covered. This book will showcase everything new in the latest version of Splunk?including the latest data models, alert actions, XML forms, various dashboard enhancements, and visualization options (with D3). Finally, we take a look at the latest Splunk cloud applications, advanced integrations, and development as per the latest release.

Who is this book for?

This book is for those who have some familiarity with Splunk and now want to learn how to develop an efficient Splunk application. Previous experience with Splunk, writing searches, and designing basic dashboards is expected.

What you will learn

  • Implement a Modular Input and a custom D3 data visualization
  • Create a directory structure and set view permissions
  • Create a search view and a dashboard view using advanced XML modules
  • Enhance your application using eventtypes, tags, and macros
  • Package a Splunk application using best practices
  • Publish a Splunk application to the Splunk community

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 27, 2016
Length: 190 pages
Edition : 2nd
Language : English
ISBN-13 : 9781785883552
Vendor :
Splunk
Category :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 27, 2016
Length: 190 pages
Edition : 2nd
Language : English
ISBN-13 : 9781785883552
Vendor :
Splunk
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 152.97
Splunk Developer's Guide, Second Edition
$48.99
Splunk Best Practices
$48.99
Advanced Splunk
$54.99
Total $ 152.97 Stars icon
Banner background image

Table of Contents

9 Chapters
1. Application Design Fundamentals Chevron down icon Chevron up icon
2. Creating Applications Chevron down icon Chevron up icon
3. Enhancing Applications Chevron down icon Chevron up icon
4. Basic Views and Dashboards Chevron down icon Chevron up icon
5. The Splunk Web Framework Chevron down icon Chevron up icon
6. Advanced Integrations and Development Chevron down icon Chevron up icon
7. Packaging Applications Chevron down icon Chevron up icon
8. Publishing Applications Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.6
(5 Ratings)
5 star 60%
4 star 0%
3 star 0%
2 star 20%
1 star 20%
Jack Coates Apr 10, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Authoritative book based on years of building high quality apps and add-ons and helping users in the Splunk community. If you're going to build Splunk content that you intend to have other people use, you should read this.
Amazon Verified review Amazon
Marco S. Feb 23, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I've been a reviewer for this book and it's been a pleasure to work with Kyle and to discover chapter after chapter how the author exposed the topics in a clear and effective way.This book is for all those people who still think that Splunk is just a geek toy: well, they will have to change their mind after reading this book! Following the labs and trying out the Reference Splunk App developed for this book, readers will find and experiment how Splunk is a complete and exhaustive platform to developer powerful data analytic application.This book is also a must read for Data Scientists that want to discover and experiment the full power and flexibility of Splunk as a developing platform, exploiting all his indexing and querying power, together with it's ability to organize and present information in an effective and immediate way.
Amazon Verified review Amazon
IAM Apr 07, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I don't know just where you are on your journey of learning how to become a competent developer of splunk add-on's and applications. As you're looking for sources of knowledge you might find yourself digging through the splunk docs, looking at other add-on's, trying the add-on builder and doing lots of trial and error. Eventually you will really want a clear and concise book just like this one. This isn't a book that has all of the in's and out's and history of Splunk. This is a book that will focus on your goal of learning how to develop splunk apps. Buy it, read it, grow!
Amazon Verified review Amazon
Vo Blinn May 12, 2017
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
While this is, likely, an exhaustive step-by-step guideon "how-to" write and install a SPLUNK app, it lacksaddressing the why's.Why would one spend time writing an app ?Chapter 1, enumerating add-ons, gives these reasons:"Applications allow us to quickly share configurations, ... " (p. 2)Regrettably, none of these reasons, especiallyinformation context related, were demonstrated.The book might benefit from an additional roundof proof-reading:"... naming source types to match your App is a good idea,This also allows you to break down the incoming data intospecific groupings" (p. 23).Unsure of how naming facilitates breaking data into groupings.Hopefully, these and other issues will be corrected in thebook's next edition.
Amazon Verified review Amazon
Anonymous Mar 23, 2017
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Disappointed
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.