Node Stats API

edit

The node stats API retrieves runtime stats about Logstash.

curl -XGET 'localhost:9600/_node/stats/<types>'

Where <types> is optional and specifies the types of stats you want to return.

By default, all stats are returned. You can limit the info that’s returned by combining any of the following types in a comma-separated list:

jvm

Gets JVM stats, including stats about threads, memory usage, garbage collectors, and uptime.

process

Gets process stats, including stats about file descriptors, memory consumption, and CPU usage.

pipeline

Gets runtime stats about the Logstash pipeline.

reloads

Gets runtime stats about config reload successes and failures.

os

Gets runtime stats about cgroups when Logstash is running in a container.

See Common Options for a list of options that can be applied to all Logstash monitoring APIs.

JVM Stats

edit

The following request returns a JSON document containing JVM stats:

curl -XGET 'localhost:9600/_node/stats/jvm?pretty'

Example response:

{
  "jvm": {
    "threads": {
      "count": 35,
      "peak_count": 36
    },
    "mem": {
      "heap_used_in_bytes": 318691184,
      "heap_used_percent": 15,
      "heap_committed_in_bytes": 519045120,
      "heap_max_in_bytes": 2075918336,
      "non_heap_used_in_bytes": 189382304,
      "non_heap_committed_in_bytes": 200728576,
      "pools": {
        "survivor": {
          "peak_used_in_bytes": 8912896,
          "used_in_bytes": 9538656,
          "peak_max_in_bytes": 35782656,
          "max_in_bytes": 71565312,
          "committed_in_bytes": 17825792
        },
        "old": {
          "peak_used_in_bytes": 106946320,
          "used_in_bytes": 181913072,
          "peak_max_in_bytes": 715849728,
          "max_in_bytes": 1431699456,
          "committed_in_bytes": 357957632
        },
        "young": {
          "peak_used_in_bytes": 71630848,
          "used_in_bytes": 127239456,
          "peak_max_in_bytes": 286326784,
          "max_in_bytes": 572653568,
          "committed_in_bytes": 143261696
        }
      }
    },
    "gc": {
      "collectors": {
        "old": {
          "collection_time_in_millis": 58,
          "collection_count": 2
        },
        "young": {
          "collection_time_in_millis": 338,
          "collection_count": 26
        }
      }
    },
    "uptime_in_millis": 382701
  }

Process Stats

edit

The following request returns a JSON document containing process stats:

curl -XGET 'localhost:9600/_node/stats/process?pretty'

Example response:

{
  "process": {
    "open_file_descriptors": 164,
    "peak_open_file_descriptors": 166,
    "max_file_descriptors": 10240,
    "mem": {
      "total_virtual_in_bytes": 5399474176
    },
    "cpu": {
      "total_in_millis": 72810537000,
      "percent": 0,
      "load_average": {
        "1m": 2.41943359375
      }
    }
  }
}

Pipeline Stats

edit

The following request returns a JSON document containing pipeline stats, including:

  • the number of events that were input, filtered, or output by the pipeline
  • stats for each configured filter or output stage
  • info about config reload successes and failures (when config reload is enabled)
  • info about the persistent queue (when persistent queues are enabled)
curl -XGET 'localhost:9600/_node/stats/pipeline?pretty'

Example response:

{
  "pipeline" : {
    "events" : {
      "duration_in_millis" : 1955,
      "in" : 100,
      "filtered" : 100,
      "out" : 100,
      "queue_push_duration_in_millis" : 71
    },
    "plugins" : {
      "inputs" : [ {
        "id" : "729b0efdc657715a4a59103ab2643c010fc46e77-1",
        "events" : {
          "out" : 100,
          "queue_push_duration_in_millis" : 71
        },
        "name" : "beats"
      } ],
      "filters" : [ {
        "id" : "729b0efdc657715a4a59103ab2643c010fc46e77-2",
        "events" : {
          "duration_in_millis" : 64,
          "in" : 100,
          "out" : 100
        },
        "matches" : 100,
        "patterns_per_field" : {
          "message" : 1
        },
        "name" : "grok"
      } ],
      "outputs" : [ {
        "id" : "729b0efdc657715a4a59103ab2643c010fc46e77-3",
        "events" : {
          "duration_in_millis" : 1724,
          "in" : 100,
          "out" : 100
        },
        "name" : "stdout"
      } ]
    },
    "reloads" : {
      "last_error" : null,
      "successes" : 2,
      "last_success_timestamp" : "2017-05-25T02:40:40.974Z",
      "last_failure_timestamp" : null,
      "failures" : 0
    },
    "queue" : {
      "events" : 0,
      "type" : "persisted",
      "capacity" : {
        "page_capacity_in_bytes" : 262144000,
        "max_queue_size_in_bytes" : 8589934592,
        "max_unread_events" : 0
      },
      "data" : {
        "path" : "/path/to/data/queue",
        "free_space_in_bytes" : 89280552960,
        "storage_type" : "hfs"
      }
    },
    "id" : "main"
  }
}

Reload Stats

edit

The following request returns a JSON document that shows info about config reload successes and failures.

curl -XGET 'localhost:9600/_node/stats/reloads?pretty'

Example response:

{
  "reloads": {
    "successes": 0,
    "failures": 0
  }
}

OS Stats

edit

When Logstash is running in a container, the following request returns a JSON document that contains cgroup information to give you a more accurate view of CPU load, including whether the container is being throttled.

curl -XGET 'localhost:9600/_node/stats/os?pretty'

Example response:

{
  "os" : {
    "cgroup" : {
      "cpuacct" : {
        "control_group" : "/elastic1",
        "usage_nanos" : 378477588075
                },
      "cpu" : {
        "control_group" : "/elastic1",
        "cfs_period_micros" : 1000000,
        "cfs_quota_micros" : 800000,
        "stat" : {
          "number_of_elapsed_periods" : 4157,
          "number_of_times_throttled" : 460,
          "time_throttled_nanos" : 581617440755
        }
      }
    }
  }