Reader small image

You're reading from  Splunk 7 Essentials - Third Edition

Product typeBook
Published inMar 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781788839112
Edition3rd Edition
Languages
Tools
Right arrow
Authors (4):
J-P Contreras
J-P Contreras
author image
J-P Contreras

J-P Contreras, a Splunk-certified administrator and sales engineer, has delivered value-oriented data analytics and performance planning solutions for 20+ years. He has built award-winning consulting teams to help companies turn data into analytical insights. He helps companies implement Splunk and enjoys everything the Splunk community offers. He received his MBA in e-commerce from DePaul University's Kellstadt Graduate School of Business, Chicago, in 2001. He trains in DePaul's Continuing Education Program and is a member of DePaul's Driehaus School of Business Advisory Board. He'd like to thank his family, especially his wife and children, and close friends for making life so enjoyable.
Read more about J-P Contreras

Erickson Delgado
Erickson Delgado
author image
Erickson Delgado

Erickson Delgado is an enterprise architect who loves to mine and analyze data. He began using Splunk in version 4.0 and has pioneered the use of the application in his current work. In the earlier parts of his career, he worked with start-up companies in the Philippines to help build their open source infrastructure. He then worked in the cruise industry as a shipboard IT manager, and he loved it. From there, he was recruited to work at the company's headquarters as a software engineer.
Read more about Erickson Delgado

Betsy Page Sigman
Betsy Page Sigman
author image
Betsy Page Sigman

Betsy Page Sigman is a distinguished professor at the McDonough School of Business at Georgetown University in Washington, D.C. She has taught courses in statistics, project management, databases, and electronic commerce for the last 16 years, and has been recognized with awards for teaching and service. She has also worked at George Mason University in the past. Her recent publications include a Harvard Business case study and a Harvard Business review article. Additionally, she is a frequent media commentator on technological issues and big data.
Read more about Betsy Page Sigman

View More author details
Right arrow

HTTP Event Collector

In this chapter, you will learn about the Splunk HTTP event collector (HEC). Metaphorically, the HEC is a catcher's mitt for Splunk to catch data sent to it via HTTP or HTTPS communication.

In this chapter, we will learn about the following topics:

  • An overview of the HEC
  • How data flows to the HEC
  • Generating an HEC token
  • Sending events in multiple formats and counts to the HEC
  • Enabling and using indexer acknowledgement

What is the HEC?

The Splunk HEC is a useful and commonly used part of Splunk. The HEC does the important function of collecting and sending HTTP and HTTPS events to other systems. One common example where the HEC adds tremendous value is by capturing/sending events from/to web and mobile-based client devices. Once Splunk captures the data via the HEC from the application, it can be used for a variety of analyses related to application use and errors.

How does the HEC work?

HTTP and HTTPS events can be created and delivered by web applications containing event metadata, such as time, host, and source, as well as other event data, found in the event key. The HEC makes it easy for app developers to add a minimal amount of code to their applications to send this data to Splunk. This is all done in a secure and efficient way, making it easy for application developers to be able to Splunk their application event data.

Typically, an application generates its own log file or uses Document Object Model (DOM) tagging to generate some relevant functional metrics. This is useful and still applicable to traditional multi-page web applications. However, web page development has moved forward in recent years, with a new framework called Single-Page Application (SPA). The advancement of SPA means most of an application's work in showing...

How data flows to the HEC

Let's begin by looking at how data flows to the HEC. This is a multi-step process that is important to understand.

Logging data

Before Splunk can capture any data, it needs to be packaged from the source, which can be done in a number of different ways:

  • A Splunk logging library for Java, JavaScript, or .NET
  • Another agent, such as a JavaScript request library
  • The Java Apache HTTP client
  • And lastly, some other client packing data in JSON or raw formats

Before going further, let's review what the JSON format means. A couple of examples of key-value pairs in JSON format are shown here. The key is listed first, then a colon, and then the value of that key. Sequences of key-value pairs must...

Summary

In this chapter, you learned about the HEC and how it can be used to send data directly from an application to Splunk. To do this, you learned how to enable the HEC and create a token used as authorization to process the request. You also saw how to use cURL to submit event data. Lastly, you learned how to enrich the HEC functionality using index acknowledgement.

In the next chapter, we'll move on and learn more ways to work with Splunk as effectively as possible.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Splunk 7 Essentials - Third Edition
Published in: Mar 2018Publisher: PacktISBN-13: 9781788839112
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.
undefined
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 $15.99/month. Cancel anytime

Authors (4)

author image
J-P Contreras

J-P Contreras, a Splunk-certified administrator and sales engineer, has delivered value-oriented data analytics and performance planning solutions for 20+ years. He has built award-winning consulting teams to help companies turn data into analytical insights. He helps companies implement Splunk and enjoys everything the Splunk community offers. He received his MBA in e-commerce from DePaul University's Kellstadt Graduate School of Business, Chicago, in 2001. He trains in DePaul's Continuing Education Program and is a member of DePaul's Driehaus School of Business Advisory Board. He'd like to thank his family, especially his wife and children, and close friends for making life so enjoyable.
Read more about J-P Contreras

author image
Erickson Delgado

Erickson Delgado is an enterprise architect who loves to mine and analyze data. He began using Splunk in version 4.0 and has pioneered the use of the application in his current work. In the earlier parts of his career, he worked with start-up companies in the Philippines to help build their open source infrastructure. He then worked in the cruise industry as a shipboard IT manager, and he loved it. From there, he was recruited to work at the company's headquarters as a software engineer.
Read more about Erickson Delgado

author image
Betsy Page Sigman

Betsy Page Sigman is a distinguished professor at the McDonough School of Business at Georgetown University in Washington, D.C. She has taught courses in statistics, project management, databases, and electronic commerce for the last 16 years, and has been recognized with awards for teaching and service. She has also worked at George Mason University in the past. Her recent publications include a Harvard Business case study and a Harvard Business review article. Additionally, she is a frequent media commentator on technological issues and big data.
Read more about Betsy Page Sigman