Creating an area chart of the application's functional statistics

Understanding not only how your web page is performing and responding to requests but also how underlying applications that you rely on is critical to the success of any website. You need to have a constant pulse on how the application is behaving and if any trends are emerging or correlations are being observed between interdependent pieces of data. The experience a customer has with your website is reliant on the constant high performance of all its components.

In this recipe, you will write a Splunk search using the timechart command to plot web application memory and response time statistics over a given time period. You will then graphically present these values using an area chart.

Getting ready

To step through this recipe, you will need a running Splunk Enterprise server, with the sample data loaded from Chapter 1, Play Time – Getting Data In. You should be familiar with the Splunk search bar, the time range picker, and the Visualization tab. It is not required, but is advisable, that you complete all the recipes up until this point.

How to do it…

Follow the given steps to create an area chart of an application's functional statistics:

  1. Log in to your Splunk server.
  2. Select the default Search & Reporting application.
  3. Ensure that the time range picker is set to Last 24 hours and type the following search into the Splunk search bar. Then, click on Search or hit Enter:
    index=main sourcetype=log4j | eval mem_used_MB=(mem_used/1024)/1024 | eval mem_total_MB=(mem_total/1024)/1024 | timechart span=1m values(mem_total_MB) AS Total_Mem_Avail_MB, count AS Total_Calls, avg(mem_used_MB) AS Avg_Mem_Used_MB, avg(response_time) AS Avg_Response_Time
  4. Splunk will return a time series chart of values for the average response time of GET and POST requests, the count of GET and POST requests, and the total count of web page visits.
  5. Click on the Visualization tab and select Area from the drop-down list of visualization types to see the data represented as an area chart. Note how the data is stacked for better visual representation of the given data:
    How to do it…
  6. Save this report by clicking on Save As and then on Report. Name the report cp03_webapp_functional_stats and click on Save. On the next screen, click on Add to Dashboard.
  7. You will now add this to the Website Monitoring dashboard. Select the button labeled Existing, and from the dropdown menu that appears, select the Website Monitoring dashboard. For the Panel Title field value, enter Web Application Functional Statistics and select Report in Panel Powered By; then, click on Save.
  8. The next screen will confirm that the dashboard has been created and the panel has been added. Click on View Dashboard to see for yourself.

How it works…

Let's break down the search piece by piece:

Search Fragment

Description

index=main sourcetype=log4j

In this example, we search for our application's logs that have the log4j sourcetype.

| eval mem_used_MB=(mem_used/1024)/1024

Using the eval command, we calculate the amount of memory currently being used, in megabytes.

| eval mem_total_MB=(mem_total/1024)/1024

Using the eval command again, we calculate the total amount of memory that is available for use, in megabytes.

| timechart span=1m values(mem_total_MB) AS Total_Mem_Avail_MB, count AS Total_Calls, avg(mem_used_MB) AS Avg_Mem_Used_MB, avg(response_time) AS Avg_Response_Time

Using the timechart command, we first specify a span of 1 minute for our events. Next, we use the values function to retrieve the value stored in the mem_total_MB field. The count function is then used to calculate the total number of function calls during the given time span. The average function is then called twice, to calculate the average amount of memory used and the average response time for the function call during the given time span. Note that we make use of the AS operator to rename the fields so that they are meaningful and easy to understand when displayed on our chart.

The Visualization tab takes the time series output of the timechart command and overlays the given visualization. In this case, you overlaid an area chart.

See also

The following is a list of recipes that you can refer to:

  • The Using a scatter chart to identify discrete requests by size and response time recipe
  • The Using a bar chart to show the average amount spent by category recipe
  • The Creating a line chart of item views and purchases over time recipe
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.182.45