Analyze Error Logs Using Sheets

このページは日本語には対応しておりません。随時翻訳に取り組んでいます。翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください。

Overview

Datadog Sheets is a spreadsheet tool that you can populate with Datadog data to perform complex analyses and build reports without requiring technical expertise.

This guide walks through creating a table of error logs, adding calculated columns to extract specific error details from error messages, and using pivot tables to summarize the data and identify patterns. It also offers an example use case of this workflow.

Creating a table in Sheets

  1. Start from a supported product page, such as the Log Explorer.
  2. Build the query of data that you want to analyze. For instance, to filter your logs to show only those with status:error that contain the word “returns” in the log message:
    status:error service:shopist-returns-prod returns
    
  3. Click Open in Sheets.
  4. Choose to create a New Spreadsheet or add the table to an Existing Spreadsheet.
  5. Click Save and Open.

Adding calculated columns

To gain more insight into your return errors, you might want to extract specific parts of the error messages. You can achieve this by adding calculated columns in Sheets.

  1. From the header of the far-right column of your table, click the Plus icon to add a calculated column.
  2. Use the REGEXEXTRACT function to pull out the actual issue with the return. For example, to extract the next word after “Failed” or “Failed to”:
    =REGEXEXTRACT(#'Message', "Failed (?:to )?(\w+)")
    
    This function helps you identify whether the error is in getting, calculating, or handling returns.

Using pivot tables for analysis

Pivot tables help you summarize and organize large datasets to find patterns and trends.

  1. From an existing spreadsheet that already has a table of data, click Add Pivot Table.
  2. In the Rows section, select the dimensions you want to analyze, such as the status of logs.
  3. In the Calculations section, choose the dimensions for calculations, like sum, average, count, min, and max.

Example use case: Analyzing retail application error logs

You have a retail web application that generates a series of error logs related to returns. You want to analyze what types of errors are causing these issues. Follow these steps to analyze your error logs, identify patterns, and gain insights into the underlying issues causing errors in your retail application. Apply this example to your logs to gain a deeper understanding of your logs and make data-driven decisions.

Example logs

  • Failed getting returns for the customer!
  • Failed to calculate returns for the customer!
  • Failed to handle returns for the customer!

Analyze error logs

  1. From the Logs Explorer, build a logs query that filters down to Error logs from your retail application with returns in the log message. For example:
    status:error service:shopist-returns-prod returns
    
    Logs Explorer showing a query for Error logs from an example retail application that contain 'returns' in the log message
  2. Click Open in Sheets to create a new table to analyze these logs.
    Modal to add a title to your new spreadsheet from Logs, such as 'Returns error analysis'

Extract specific error data

Add a calculated column in Sheets to pull out the specific issue with the return using the REGEXEXTRACT function: =REGEXEXTRACT(#'Message', "Failed (?:to )?(\w+)")

Analyze error types

  1. Create a pivot table to count the number of errors per error type (getting, calculating, and handling).
  2. Summarize the data to understand the distribution and total impact of each error type.

Further reading

PREVIEWING: alai97/reorganize-some-sections-in-dora-metrics