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
Splunk Developer?s Guide

Splunk Developer?s Guide: Design, implement, and publish custom Splunk applications and add-ons following best practices

eBook
Can$35.99 Can$39.99
Paperback
Can$39.99 Can$49.99
Subscription
Free Trial

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
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

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 hand-written Apps. 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 your 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 end user to perform...

Point of order

As we continue to progress through this book, we will create an App from the ground up. The App's name will be SDG (from a filesystem perspective) and the App "label" will be "Developer's Guide for Splunk." It will be available in its entirety on Splunk base 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 for 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.

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:

  • Identify the use case:
    • We are building this App as a learning experience for the reader. By providing an App at the end of this book, with all the...

Methods of creating applications

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

Tip

Protip

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 all 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 is to log...

Basic structures

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.

The appserver folder

The appserver folder contains configurations and other files that relate to 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.

The bin folder

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.

The default folder

The default folder contains all the "App publishers" configurations...

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 because 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

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

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 interpretations" 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 searched 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.

It can be found at: http://docs.splunk.com/Splexicon:Searchmacro

Macros are configured through the Advanced Configuration section of the GUI, or via the macros.conf file located within the App. They are very useful for building...

Point of order


As we continue to progress through this book, we will create an App from the ground up. The App's name will be SDG (from a filesystem perspective) and the App "label" will be "Developer's Guide for Splunk." It will be available in its entirety on Splunk base 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 for 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.

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:

  • Identify the use case:

    • We are building this App as a learning experience for the reader. By providing an App at the end of this book, with all the examples from the book contained within the...

Methods of creating applications


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

Tip

Protip

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 all 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 is to log...

Left arrow icon Right arrow icon

Description

If you are a Splunk user and want to enter the wonderful world of Splunk application development, then this book is for you. Some experience with Splunk, writing searches, and designing basic dashboards is expected.

Who is this book for?

If you are a Splunk user and want to enter the wonderful world of Splunk application development, then this book is for you. Some experience with Splunk, writing searches, and designing basic dashboards is expected.

What you will learn

  • Implement 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 event types, 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 : May 28, 2015
Length: 180 pages
Edition : 1st
Language : English
ISBN-13 : 9781785280320
Category :
Languages :
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
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 28, 2015
Length: 180 pages
Edition : 1st
Language : English
ISBN-13 : 9781785280320
Category :
Languages :
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 Can$6 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 Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 158.37 197.97 39.60 saved
Implementing Splunk (Update)
Can$62.39 Can$77.99
Splunk Developer?s Guide
Can$39.99 Can$49.99
Splunk Operational Intelligence Cookbook
Can$55.99 Can$69.99
Total Can$ 158.37 197.97 39.60 saved Stars icon

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

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
(6 Ratings)
5 star 66.7%
4 star 0%
3 star 16.7%
2 star 0%
1 star 16.7%
Filter icon Filter
Top Reviews

Filter reviews by




David Paper Jul 06, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As Splunk has grown up, books focusing on specific functions in depth become much more interesting. App development is something that most Splunk admins do, but may not fully understand all of the components available to them. Over time, Splunk had added new features like HTML dashboards, which many admins may not be taking advantage of.The progression of SimpleXML -> AdvancedXML -> HTML dashboards is not without friction. The SDG sheds light on how it works and begins to demystify the creation of HTML dashboards.-I quite liked how the author laid out at the very beginning what this book wouldn't cover. While this book isn’t aimed at only Splunk experts, it is also not a primer on the basics and expects the reader to have solid Splunk experience.-Good flow starting at a holistic view, then breaking it down into building blocks of Splunk Knowledge Objects, and then building back up to the app creation itself and how to assemble the pieces. Along the way, snippets of automation and best practices are thrown in re-enforcing not just the how, but the why.-The author strikes a good balance between CLI interaction with the .conf files that powers Splunk under the hood with the GUI techniques for accomplishing many of the same tasks.-App packaging standards are often overlooked, but not here.A great addition to every Splunk admins bookshelf.
Amazon Verified review Amazon
NancyKafer Aug 03, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This guide is very helpful for both beginning Splunk developers and advanced Splunk developers. The author does a nice job of building a good foundation by explaining the building blocks that will be used later to build advanced HTML dashboards. The examples are also very well laid out. I would recommend this guide to all Splunk developers.
Amazon Verified review Amazon
Jack Coates Jul 08, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Nicely done introduction into developing Splunk apps and add-ons, this is a solid entry point for anyone wanting to get started with big data in the Splunk ecosystem.
Amazon Verified review Amazon
Ravi Shankar Jul 04, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I purchased this book to learn more about Splunk Application Development. It did not disappoint me, author has covered this wide subject in a clean and concise way. The modular inputs chapter was well written as the splunk documentation was not very clear on this topic. Simple example get you to the concept quickly. I recommend this book for all starters who wants to learn app development using Splunk. Go for it.
Amazon Verified review Amazon
uofakron Oct 02, 2015
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Kindle eBookThe bad:This is what I found wrong, my perspective may be flawed, possibly from my inexperience with Splunk, it's just how I see it. If the points touched upon here are not valid, feel free to dismiss this review without prejudice. The book from its inception references data from Meh API (a wonderful website from the creators of woot, which provides a single shopping deal daily) in both text and screenshots, but to no avail provides instructions on how to obtain it/reference/ nor implement it as a data source …. I'm really wondering if I’m missing something, I went over the beginning of the book over and over again, looking for a data load explanation of where the meh API is being implemented, and I got nothing. Even went to publisher’s site and downloaded associated files … It’s like the section on how to consume the data from meh API is just plain missing. I looked online and saw that I am not the only person with same question, so either we are both "off ". If it’s actually there and we both missed it (still a possibility), better communication is needed to convey the meh API setup in the book , or the data setup for a book on data is just plain missing . Downloading the book's Splunk app is not enough. The downloadable app does not work out of the box on Ubuntu 14; maybe all Splunk apps don’t and need additional setup? Did I mention it doesn't work, shocker!, maybe it’s because I’m using 6.3 and it broke on the import, IDK... what I do know is there are no specific instructions in order to set the meh API up otherwise, and there is meh.py in the downloaded files not mentioned in the eBook.On a side note: poor choice in data sources because most likely the results won’t match up with the books, and they are functionally useless because meh items sold changes only once a day, so pie charts and such on a search of multiple sale items referenced is pointless when the deal of the day changes daily (the pie charts are all one color) … I am not seeing any meh documentation on pulling previous days json either. Had to chuckle when data from meh over last 30 days was mentioned. I'm like, "I don’t have that much time to let data accrue especially over a 150pg tech book I can get thru over a day or two…” The reader wanting to follow along with the tutorial is basically forced to fudge their own data. You will have to substitute daily deals in the book with current one, no biggie, but what about variety? You’re practically inserting duplicate records, and comparing the same daily deal to itself thousands of times over doesn’t do much for aggregation.I really question the publisher's reviewers for this book:IMHO, It’s obvious the publishing reviewers (the ones cited in the credits) did not either have the same book, or did not validate the tutorials. Examples:• How do you load the data from meh API? api.meh.com isn’t even searchable in the eBook.• Where's the poll extraction macro defined in summary indexing? I had to get it from the downloaded Splunk app…• Chapter 5 seems to be referencing examples (meh_clicks, visitors,etc…) introduced in chapter 6.It really makes wonder if I am missing something somewhere fundamental, it’s hard to believe that four people reviewed this book before it was published and these observations were not reconciled.To fellow readers:• For "theoretical learners" it’s fantastic (reading the book only), for "practical learners” (ones who want to follow along by practicing the tutorials), the tutorials involving meh data are disappointing.• Only buy the eBook if under $20...• Give up on trying to following the tutorials on your own, and just read it like a book, because you will not see the same results, nor will have complete instructions if you attempt to follow all the tutorials.• If you must, download and install the app from the publisher, it half works after you tweak it. Of course, it doesn’t work..., but it’s much easier to work with than the tutorials direction from the book. Don’t try to start one from scratch.To the author (IMHO):• Next time, get better reviewers, no one can check their own work and the ones credited in the book didn’t do their job, you didn’t fail, they failed you.• Please export the meh data that is referenced in the book, and distribute it from the book publisher’s website. It will help those people who are trying to double check their work based on the visualizations.• Also, besides distributing a comprehensive (non-working) Splunk app, the Splunk app should also be distributed per book chapter containing only the changes within the scope of the chapter.• Needs more content on actual application development, my goal after reading this book was professionalize my Splunk application development. It seems only a fraction of the book is dedicated to actual application development. What about delving head first into a SDK, if they are being utilized it’s not directly mentioned. I was disappointed when a data model was defined/discussed but no tutorial was given. What about custom control creation?If my perspective is wrong or miss-spoke, I am soooo sorry!The good:The book does have its good points, its not a complete mess...., ok, yes it is.However….I like:• The authors wording for Splunk explanations, it has helped me to understand the concepts much clearer. I found Splunk docs explanations as a hard read. I was also weary of digging in to the conf files before, and have found a new confidence during my reading.• The heuristics and best practices the book explains.• How the author displays the code/whatever in the topic then surgically dissects and thoroughly explains what each component does.If you read it like a book, and not attempt to follow the tutorials you should get your $18 (ebook) worth, still worth it…Again, if I am way off, or if anything mentioned that wasn’t there really was there under my nose, I apologize in advance. I know I ripped this book to shreds, I'm really hoping I'm wrong.
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.

Modal Close icon
Modal Close icon