Skip to main content
Sumo Logic

Collect Metrics for the Host Metrics (EC2) App

This page describes the data sources for the Host Metrics (EC2) app, and has instructions for setting up metric collection.

The Host Metrics (EC2) app relies upon an Installed Collector with a Host Metrics Source on each of your AWS EC2 hosts. This page describes the data sources for the Host Metrics (EC2) app and has instructions for setting up metric collection. 

Field in Field Schema

Login to Sumo Logic,  goto Manage Data > Logs > Fields. Search for the “instanceid” field. If not present, create it. Learn how to create and manage fields here.

Configure Host Metrics sources 

Follow the instructions in this section to configure the Sumo Logic Installed Collector and a Host Metrics Source on each of your AWS EC2 hosts. You will assign account and Namespace metadata fields to the sources so that incoming logs and metrics will be appropriately tagged.

Perform these steps for each EC2 host.

  1. Set up an Installed Collector. For instructions, see Installed Collectors.

  2. Add a Host Metrics Source to the Installed Collector. For instructions, see Manually Configure a Host Metrics Source. In the Fields portion of the configuration::

    1. Add a field named account, and set it to your AWS account alias.

    2. Add a field named Namespace and set it to AWS/EC2. 

  3. Set the Scan Interval (the frequency at which the Source is scanned) to 1 minute. 

You can also build your EC2 AMI machine image with these fields and settings. For instructions, see this blog. Here’s a sample sources.json file that you can include in your AMI.

{
  "api.version": "v1",
   "source": {
    "name": "Host Metrics",
    "category": "hostmetrics",
    "automaticDateParsing": false,
    "multilineProcessingEnabled": true,
    "useAutolineMatching": true,
    "contentType": "HostMetrics",
    "forceTimeZone": false,
    "filters": [],
    "cutoffTimestamp": 0,
    "encoding": "UTF-8",
    "fields": {
      "account": "<your AWS account alias>",
      "Namespace": "AWS/EC2"
    },
    "thirdPartyRef": {
      "resources": [
        {
          "serviceType": "HostMetrics",
          "path": {
            "type": "NoPathExpression"
          },
          "authentication": {
            "type": "NoAuthentication"
          }
        }
      ]
    },
    "interval": 300000,
    "metrics": [
      "CPU_User",
      "CPU_Sys",
 …..
    ],
    "processMetrics": [],
    "sourceType": "SystemStats"
  }
}

AWS Metadata

Collectors running on AWS EC2 instances can optionally collect AWS Metadata such as EC2 tags to make it easier to search for Host Metrics. Only one AWS Metadata Source for Metrics is required to collect EC2 tags from multiple hosts. For more information, see AWS Metadata Source for Metrics.