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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Splunk Operational Intelligence Cookbook

You're reading from   Splunk Operational Intelligence Cookbook With Splunk, reporting and communicating insight is simple – find out with this Splunk book, created to help you unlock more effective Business Intelligence

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher
ISBN-13 9781849697842
Length 414 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Play Time – Getting Data In FREE CHAPTER 2. Diving into Data – Search and Report 3. Dashboards and Visualizations – Make Data Shine 4. Building an Operational Intelligence Application 5. Extending Intelligence – Data Models and Pivoting 6. Diving Deeper – Advanced Searching 7. Enriching Data – Lookups and Workflows 8. Being Proactive – Creating Alerts 9. Speed Up Intelligence – Data Summarization 10. Above and Beyond – Customization, Web Framework, REST API, and SDKs Index

Defining field extractions

Splunk has many built-in features, including knowledge on several common source types, which lets it automatically know what fields exist within your data. Splunk will, by default, also extract any key-value pairs present within the log data and all fields within JSON-formatted logs. However, often, fields within raw log data cannot be interpreted out of the box, and this knowledge must be provided to Splunk in order to make these fields easily searchable.

The sample data that we will be using in subsequent chapters contains data we wish to present as fields to Splunk. Much of the raw log data contains key-value fields that Splunk will extract automatically, but we need to tell Splunk how to extract one particular field that represents the page response time. To do this, we will be adding a custom field extraction, which will tell Splunk how to extract the field for us.

Getting ready

To step through this recipe, you will need a running Splunk server with the operational intelligence sample data loaded. There are no other prerequisites.

How to do it...

Follow the given steps to add a custom field extraction for response:

  1. Log in to your Splunk server.
  2. In the top-right corner, click on the Settings menu, and then click on the Fields link.
    How to do it...
  3. Click on the Field extractions link.
    How to do it...
  4. Click on New.
  5. In the Destination app field, select the search app, and in the Name field, enter response. Set the Apply to dropdown to sourcetype and the named field to access_combined. Set the Type dropdown to Inline, and for the Extraction/Transform field, carefully enter the (?i)^(?:[^"]*"){8}\s+(?P<response>.+) regex.
    How to do it...
  6. Click on Save.
  7. On the Field Extractions listing page, find the recently added extraction, and in the Sharing column, click on the Permissions link.
    How to do it...
  8. Update the Object should appear in setting to All apps. In the Permissions section, for the Read column, check Everyone, and in the Write column, check admin. Then, click on Save.
    How to do it...
  9. Navigate to the Splunk search screen and enter the following search over the Last 60 minutes time range:
    index=main sourcetype=access_combined

You should now see a field called response extracted on the left-hand side of the search screen under the Interesting Fields section.

How it works...

All field extractions are maintained in the props.conf and transforms.conf configuration files. The stanzas in props.conf include an extraction class that leverages regular expressions to extract field names and/or values to be used at search time. The transforms.conf file goes further and can be leveraged for more advanced extractions such as reusing or sharing extractions over multiple sources, source types, or hosts.

See also

  • The Loading the sample data for this book recipe
  • The Defining event types and tags recipe
You have been reading a chapter from
Splunk Operational Intelligence Cookbook
Published in: Oct 2014
Publisher:
ISBN-13: 9781849697842
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