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
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
| Parameter | Status | Description |
|---|---|---|
email | Required | Your Opensolr registration email address |
api_key | Required | Your Opensolr API key (master key, or a scoped key that allows this endpoint) |
index_name | Required | The index to watch (note: index_name, not core_name) |
interval | Optional | Seconds between ticks (default 1) |
max | Optional | Number 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:
| Key | Type | Description |
|---|---|---|
core_name | string | The index |
new_requests | int | Requests since the previous tick |
requests | array | The new request log lines |
timestamp / timestamp_readable | int / string | Tick time |
stream_server_data lines:
| Key | Type | Description |
|---|---|---|
cpu | string | CPU usage % |
mem | string | Memory used % |
disk | string | Disk used % |
load | string | 1, 5 and 15-minute load average |
time | string | Sample time (server clock) |
hardware | object | First 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
$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']); }
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