API /count/total gone in Graylog 4

This topic has not been answered and issue still occurs with 4.0.6:

Same happened for me, /count/total is gone after upgrading to Graylog 4 “HTTP 404 Not Found”, with no warning whatsoever in the docs.

Either the API was supposed to be removed for Graylog 4, then you should update the documentation to say so, along with the recommended API equivalent, or this was not intended and the endpoint needs to be restored.

Hi @bitwiz , you’re totally right that we seemed to have overlooked adding the removal of the /count endpoint to the Upgrade doc. I will note that it’s present in the changelog here: Changelog — Graylog 4.0.0 documentation, specifically:

But that’s pretty well buried at this point if you’re not sure of what you’re looking for. I’ve opened an issue on the docs site and you can follow along with it here: `/count` API was not included in the API Removals Section of the upgrading doc · Issue #1129 · Graylog2/documentation · GitHub.

I’ll also note that the /count/ endpoint was a wrapper for another endpoint in Graylog, which is why our developers decided to get rid of it.

You can still search for messages and get a count using the /system/indexer/overview API, though it’s not as intuitive as the /count API was. For example, the responsebody for that endpoint results in:

{
  "deflector": {
    "current_target": "graylog_12",
    "is_up": true
  },
  "indexer_cluster": {
    "health": {
      "status": "GREEN",
      "shards": {
        "active": 1060,
        "initializing": 0,
        "relocating": 0,
        "unassigned": 0
      }
    },
    "name": "graylog"
  },
  "counts": {
    "events": 134432587
  },
  "indices": {
    "graylog_9": {
      "size": {
        "events": 358286,
        "deleted": 0,
        "bytes": 68324238
      },
      "range": {
        "index_name": "graylog_9",
        "begin": "2021-04-11T20:00:18.000Z",
        "end": "2021-04-13T00:00:08.000Z",
        "calculated_at": "2021-04-13T00:00:43.668Z",
        "took_ms": 959
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_8": {
      "size": {
        "events": 120201,
        "deleted": 0,
        "bytes": 29795227
      },
      "range": {
        "index_name": "graylog_8",
        "begin": "2021-04-10T20:00:18.000Z",
        "end": "2021-04-12T00:00:14.000Z",
        "calculated_at": "2021-04-12T00:01:04.309Z",
        "took_ms": 1480
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_7": {
      "size": {
        "events": 430568,
        "deleted": 0,
        "bytes": 86883848
      },
      "range": {
        "index_name": "graylog_7",
        "begin": "2021-04-09T20:00:14.000Z",
        "end": "2021-04-11T00:00:13.000Z",
        "calculated_at": "2021-04-11T00:00:46.954Z",
        "took_ms": 1006
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_6": {
      "size": {
        "events": 642098,
        "deleted": 0,
        "bytes": 113100044
      },
      "range": {
        "index_name": "graylog_6",
        "begin": "2021-04-08T21:28:58.000Z",
        "end": "2021-04-10T00:00:12.000Z",
        "calculated_at": "2021-04-10T00:00:44.038Z",
        "took_ms": 1033
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_1": {
      "size": {
        "events": 20000601,
        "deleted": 0,
        "bytes": 7587526705
      },
      "range": {
        "index_name": "graylog_1",
        "begin": "2020-09-28T05:13:59.000Z",
        "end": "2020-10-05T04:37:48.000Z",
        "calculated_at": "2021-04-09T13:13:50.242Z",
        "took_ms": 1842
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_0": {
      "size": {
        "events": 20000353,
        "deleted": 0,
        "bytes": 5394719067
      },
      "range": {
        "index_name": "graylog_0",
        "begin": "2020-09-16T15:34:05.000Z",
        "end": "2020-09-28T05:13:58.000Z",
        "calculated_at": "2021-04-09T13:13:52.106Z",
        "took_ms": 4875
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_5": {
      "size": {
        "events": 9837231,
        "deleted": 0,
        "bytes": 2579897062
      },
      "range": {
        "index_name": "graylog_5",
        "begin": "2020-11-19T07:39:10.755Z",
        "end": "2021-04-09T13:13:33.000Z",
        "calculated_at": "2021-04-09T13:14:17.856Z",
        "took_ms": 530
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_10": {
      "size": {
        "events": 88897,
        "deleted": 0,
        "bytes": 23739577
      },
      "range": {
        "index_name": "graylog_10",
        "begin": "2021-04-12T20:00:15.000Z",
        "end": "2021-04-14T00:00:10.000Z",
        "calculated_at": "2021-04-14T00:00:50.606Z",
        "took_ms": 701
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_4": {
      "size": {
        "events": 42822659,
        "deleted": 0,
        "bytes": 12653985103
      },
      "range": {
        "index_name": "graylog_4",
        "begin": "2019-09-16T22:28:04.869Z",
        "end": "2020-12-11T03:18:02.000Z",
        "calculated_at": "2021-04-09T13:13:57.540Z",
        "took_ms": 5217
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_12": {
      "size": {
        "events": 59062,
        "deleted": 0,
        "bytes": 17565636
      },
      "range": {
        "index_name": "graylog_12",
        "begin": "1970-01-01T00:00:00.000Z",
        "end": "1970-01-01T00:00:00.000Z",
        "calculated_at": "2021-04-15T00:00:13.358Z",
        "took_ms": 0
      },
      "is_deflector": true,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_3": {
      "size": {
        "events": 20000031,
        "deleted": 0,
        "bytes": 7715850235
      },
      "range": {
        "index_name": "graylog_3",
        "begin": "2020-10-10T18:31:00.000Z",
        "end": "2020-10-21T00:59:50.000Z",
        "calculated_at": "2021-04-09T13:14:02.769Z",
        "took_ms": 1079
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_2": {
      "size": {
        "events": 20000561,
        "deleted": 0,
        "bytes": 7492495228
      },
      "range": {
        "index_name": "graylog_2",
        "begin": "2020-10-05T00:37:51.000Z",
        "end": "2020-10-10T22:30:54.000Z",
        "calculated_at": "2021-04-09T13:14:03.866Z",
        "took_ms": 3097
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    },
    "graylog_11": {
      "size": {
        "events": 71901,
        "deleted": 0,
        "bytes": 18976093
      },
      "range": {
        "index_name": "graylog_11",
        "begin": "2021-04-13T20:00:23.000Z",
        "end": "2021-04-15T00:00:10.000Z",
        "calculated_at": "2021-04-15T00:00:44.642Z",
        "took_ms": 966
      },
      "is_deflector": false,
      "is_closed": false,
      "is_reopened": false
    }
  }
}

And the top events object in the JSON response is the sum of all events in the cluster. You can retrieve the same results for an index set using /system/indexer/overview/{indexSetId} as you would with the old /count/{indexSetId}/total endpoint. Let me know if this gets you what you need. If you’d like to chime in on the docs issue mentioned above, I’d encourage you to add your voice to it so that our technical writing team can make the necessary adjustments.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.