API - Live Streams: Solr Requests and Server Metrics

Logs & Analytics
Logs & Analytics API

Live Streams: Solr Requests and Server Metrics

Two streaming endpoints that keep the HTTP connection open and push one JSON object per line. stream_solr_log reports the new Solr requests received by your index since the previous tick; stream_server_data reports CPU, memory, disk and load of the machine hosting the index. They power the live monitoring widgets of the Opensolr control panel and can feed your own dashboards.

Endpoint

GET https://opensolr.com/solr_manager/api/stream_solr_log
GET https://opensolr.com/solr_manager/api/stream_server_data
Streaming response. Read the body incrementally (curl -N, requests.get(stream=True), fopen + fgets). Every JSON line is followed by a block of ~4 KB of whitespace that forces intermediate proxies to flush — trim each line before parsing and skip empty ones. The connection closes after max ticks.

Parameters

ParameterStatusDescription
emailRequiredYour Opensolr registration email address
api_keyRequiredYour Opensolr API key (master key, or a scoped key that allows this endpoint)
index_nameRequiredThe index to watch (note: index_name, not core_name)
intervalOptionalSeconds between ticks (default 1)
maxOptionalNumber of ticks before the stream ends; use a large value for a long-lived stream and close the connection when done

How It Works

Opensolr opens a channel to the agent on the server that hosts your index and relays what it emits, tick by tick. stream_solr_log tails the Solr request log for the index and, at each tick, sends the count and the list of requests that arrived since the last tick (an idle index produces "new_requests":0 with an empty list). stream_server_data samples the host’s cpu (%), mem (% used), disk (% used) and 1/5/15-minute load; the first line also carries a hardware block with total RAM, disk and CPU cores. If the agent cannot be reached the stream contains a single {"status":false,"msg":"Connection failed: ..."} line.

Response

stream_solr_log lines:

KeyTypeDescription
core_namestringThe index
new_requestsintRequests since the previous tick
requestsarrayThe new request log lines
timestamp / timestamp_readableint / stringTick time

stream_server_data lines:

KeyTypeDescription
cpustringCPU usage %
memstringMemory used %
diskstringDisk used %
loadstring1, 5 and 15-minute load average
timestringSample time (server clock)
hardwareobjectFirst line only: total_ram_gb, total_disk_gb, cpu_cores

Code Examples

$_ cURL

# -N disables curl's buffering so lines show up as they arrive
curl -s -N "https://opensolr.com/solr_manager/api/stream_server_data?email=YOUR_EMAIL&api_key=YOUR_API_KEY&index_name=my_index&interval=2&max=10" | grep -v '^\s*$'
curl -s -N "https://opensolr.com/solr_manager/api/stream_solr_log?email=YOUR_EMAIL&api_key=YOUR_API_KEY&index_name=my_index&interval=1&max=60" | grep -v '^\s*$'

PHP PHP

$q = http_build_query(['email' => 'YOUR_EMAIL', 'api_key' => 'YOUR_API_KEY', 'index_name' => 'my_index', 'interval' => 2, 'max' => 10]);
$fp = fopen("https://opensolr.com/solr_manager/api/stream_server_data?{$q}", 'r');
while ($fp && !feof($fp)) {
    $line = trim(fgets($fp));
    if ($line === '') continue;              // skip the flush padding
    $tick = json_decode($line, true);
    printf("%s cpu=%s%% mem=%s%% load=%s\n", $tick['time'], $tick['cpu'], $tick['mem'], $tick['load']);
}

Py Python

import json, requests

params = {"email": "YOUR_EMAIL", "api_key": "YOUR_API_KEY", "index_name": "my_index", "interval": 1, "max": 60}
with requests.get("https://opensolr.com/solr_manager/api/stream_solr_log", params=params, stream=True, timeout=(10, None)) as r:
    for raw in r.iter_lines():
        line = raw.decode().strip()
        if not line:
            continue                       # flush padding
        tick = json.loads(line)
        if tick.get("new_requests"):
            print(tick["timestamp_readable"], tick["requests"])

Example Response

{"cpu":"1.6","mem":"55.18","disk":"23","load":"0.32, 0.33, 0.36","time":"20:29:48","hardware":{"total_ram_gb":126,"total_disk_gb":1755,"cpu_cores":24}}
{"cpu":"1.5","mem":"55.18","disk":"23","load":"0.37, 0.34, 0.36","time":"20:29:51"}

{"core_name":"my_index","new_requests":0,"requests":[],"timestamp":1787948996,"timestamp_readable":"2026-08-28 20:29:56"}

Use Cases

  • Live “requests per second” and server-health widgets in your own admin
  • Watch a load test hit the index in real time
  • Record a short window of raw traffic while reproducing a problem

Related Documentation

Need help with the Opensolr API? We are here to help.

Contact Support