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

Mastering Splunk: Optimize your machine-generated data effectively by developing advanced analytics with Splunk

eBook
€28.99 €32.99
Paperback
€41.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

Mastering Splunk

Chapter 2. Advanced Searching

In this chapter, we will demonstrate advanced searching topics and techniques, providing meaningful examples as we go along. The following topics will be covered:

  • Searching for operators, command formats, and tags
  • Subsearching
  • Searching with parameters
  • Efficient searching with macros
  • Search results

Searching in Splunk

It would be negligent for a book on mastering Splunk searching to not mention the dashboard of version 6.0.

The search dashboard

If you take a look at the Splunk search dashboard (and you should), you can break it down into four general areas. They are given as follows:

  • The search bar: The search bar is a long textbox into which you can enter your searches when you use Splunk Web.
  • Range picker: Using the (time) range picker, you can set the period over which to apply your search. You are provided with a good supply of preset time ranges that you can select from, but you can also enter a custom time range.
  • How-To (panel): This is a Splunk panel that contains links that you can use to access the Search Tutorial and Search Manual pages.
  • What-To (panel): This is another Splunk panel that displays a summary of the data that is installed on the current Splunk instance.

The new search dashboard

After you run a new search, you're taken to the New Search page. The search bar and...

Knowledge management

As mentioned, you can define or create Splunk transactional types for later use by yourself or for other Splunk users by utilizing the transactiontypes.conf file. A lot of thought should go into a Splunk knowledge management strategy. You will find more on this topic later in this book, but for now, here are the basics you can use to define some Splunk transactions:

  1. If it doesn't already exist, you can use a text editor to create a transactiontypes.conf file in $SPLUNK_HOME/etc/system/local/ or your own custom app directory in $SPLUNK_HOME/etc/apps/.
  2. Next, define transactions using the following arguments:
    [<transactiontype>]
    maxspan =  [<integer> s|m|h|d|-1]
    maxpause = [<integer> s|m|h|d|-1]
    fields = <comma-separated list of fields>
    startswith = <transam-filter-string>
    endswith=<transam-filter-string>

Let's discover the functions of the code terms in the preceding example:

  • transactiontype: This is the name of the transaction...

Subsearching

A subsearch is a Splunk search that uses a search pipeline as the argument. Subsearches in Splunk are contained in square brackets and evaluated first. Think of a subsearch as being similar to a SQL subquery (a subquery is a SQL query nested inside a larger query).

Subsearches are mainly used for three purposes:

  • To parameterize one search using the output of another search
  • To run a separate search but to stitch the output to the first search using the append command
  • To create a conditional search where you only see the results of your search if the result meets the criteria or perhaps the threshold of the subsearch

Generally, you use a subsearch to take the results of one search and use them in another search, all in a single Splunk search pipeline. Because of how this works, the second search must be able to accept arguments, such as with the append command (as mentioned earlier).

Some examples of subsearching are as follows:

  • Parameterization: Consider the following code:
    sourcetype...

Searching with parameters

In Splunk, searches can be initiated in both Splunk Web as well as in the Splunk command-line interface or CLI (for information on how to access the CLI and find help for it, refer to the SplunkAdmin manual).

Your searches in CLI work the same way as searches in Splunk Web, except that there is no timeline given with the search results and there is no default time range. Instead, the results are displayed as a raw events list or a table, depending on the type of your search. Searching parameters (such as batch, header, and wrap) are options that control the way the CLI search is run or the way the search results are displayed.

Note

In addition to Splunk Web and Splunk CLI, there is an applications programming interface (API) available, which Splunk programmers can use to perform searches and manage Splunk configurations and objects.

Searching with the CLI will not be covered in this book, so our discussion on searching with parameters will focus on the (advanced) searching...

Splunk macros

A Splunk macro can be thought of as a (hopefully, previously tested and otherwise validated) reusable assembly of Splunk (or business) logic—basically, any part or even all of a Splunk search that you don't want to type in again. Saved macros can even be defined to receive arguments when reused. Splunk macros are an integral part of knowledge management.

To understand how macros might be defined, saved, and reused, let's take a look at the previous example using the previously defined eval statement. In the following search, we defined a new field to be evaluated and searched on, named event_date:

sourcetype=TM1* error | EVAL event_date =  date_month  + "/" + date_mday + "/" + date_year | where event_date = "october/24/2007"

The event_date field is made up of the date_month, date_mday, and date_year fields. Since we will perhaps want to perform multiple searches in the future, searching for events that occurred on different dates...

Searching in Splunk


It would be negligent for a book on mastering Splunk searching to not mention the dashboard of version 6.0.

The search dashboard

If you take a look at the Splunk search dashboard (and you should), you can break it down into four general areas. They are given as follows:

  • The search bar: The search bar is a long textbox into which you can enter your searches when you use Splunk Web.

  • Range picker: Using the (time) range picker, you can set the period over which to apply your search. You are provided with a good supply of preset time ranges that you can select from, but you can also enter a custom time range.

  • How-To (panel): This is a Splunk panel that contains links that you can use to access the Search Tutorial and Search Manual pages.

  • What-To (panel): This is another Splunk panel that displays a summary of the data that is installed on the current Splunk instance.

The new search dashboard

After you run a new search, you're taken to the New Search page. The search bar and time...

Knowledge management


As mentioned, you can define or create Splunk transactional types for later use by yourself or for other Splunk users by utilizing the transactiontypes.conf file. A lot of thought should go into a Splunk knowledge management strategy. You will find more on this topic later in this book, but for now, here are the basics you can use to define some Splunk transactions:

  1. If it doesn't already exist, you can use a text editor to create a transactiontypes.conf file in $SPLUNK_HOME/etc/system/local/ or your own custom app directory in $SPLUNK_HOME/etc/apps/.

  2. Next, define transactions using the following arguments:

    [<transactiontype>]
    maxspan =  [<integer> s|m|h|d|-1]
    maxpause = [<integer> s|m|h|d|-1]
    fields = <comma-separated list of fields>
    startswith = <transam-filter-string>
    endswith=<transam-filter-string>

Let's discover the functions of the code terms in the preceding example:

  • transactiontype: This is the name of the transaction type

  • maxspan...

Left arrow icon Right arrow icon

Description

This book is for those Splunk developers who want to learn advanced strategies to deal with big data from an enterprise architectural perspective. You need to have good working knowledge of Splunk.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 17, 2014
Length: 344 pages
Edition : 1st
Language : English
ISBN-13 : 9781782173847
Vendor :
Splunk
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
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Dec 17, 2014
Length: 344 pages
Edition : 1st
Language : English
ISBN-13 : 9781782173847
Vendor :
Splunk
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 €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 125.97
Mastering Splunk
€41.99
Splunk Operational Intelligence Cookbook
€41.99
Implementing Splunk: Big Data Reporting and Development for Operational Intelligence
€41.99
Total 125.97 Stars icon

Table of Contents

12 Chapters
1. The Application of Splunk Chevron down icon Chevron up icon
2. Advanced Searching Chevron down icon Chevron up icon
3. Mastering Tables, Charts, and Fields Chevron down icon Chevron up icon
4. Lookups Chevron down icon Chevron up icon
5. Progressive Dashboards Chevron down icon Chevron up icon
6. Indexes and Indexing Chevron down icon Chevron up icon
7. Evolving your Apps Chevron down icon Chevron up icon
8. Monitoring and Alerting Chevron down icon Chevron up icon
9. Transactional Splunk Chevron down icon Chevron up icon
10. Splunk – Meet the Enterprise Chevron down icon Chevron up icon
A. Quick Start Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.7
(3 Ratings)
5 star 33.3%
4 star 0%
3 star 0%
2 star 33.3%
1 star 33.3%
JDMiller Mar 19, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Enjoyed this.
Amazon Verified review Amazon
lisle_g Mar 12, 2015
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Here is my first complaint: for $45, I expect at least some of the diagrams to be in color. Instead, the publisher has a download site where you can get a color PDF of the diagrams. Annoying, particularly when the author writes "If you haven't noticed, I have used the color attribute..." No, it didn't really show up in the black-and-white diagram!!The book tries to provide some high-level context for Splunk, but it is uneven. By page 7, the book discusses using a single Splunk server vs. multiple servers, but has built no foundation for this discussion. I often found myself saying: "true, but why do I care?" Other than a scattering of screenshots, the book has few illustrations (so maybe color isn't so important). The discussion also seems jumpy, as if the author has a number of facts about Splunk without having an organized way of presenting them. This made the topics harder to understand, even though most topics are treated superficially (e.g., sizing the Splunk installation). Even the detailed topics, like searching, start with a discussion of tags before even the most simple search is introduced.I found some of the examples simplistic; most were not well-explained. Other examples illustrate poor Splunk usage, particularly around subsearches. Complex topics such as macros are introduced way too early and with little explanation. There are typos in some of the examples.If you know Splunk, you won't learn anything new from this book. If you don't know Splunk, I don't know how you will achieve any of the items listed on the back of the book as "what you will learn from this book."Another reviewer said that this book had a chapter on the Splunk documentation. It does not, but you could certainly look at the free tutorials, videos and online documentation at splunk.com, and save your money.
Amazon Verified review Amazon
kingofgeek Jan 27, 2015
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
THIS BOOK IS HORRIBLE! ITS HAS A CHAPTER ON SPLUNK DOCUMENTATION WTF!!!!!!
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.