Redis INFO Output Parser

3.1.0 · maintenance · verified Tue Apr 21

redis-info is a focused JavaScript utility designed to accurately parse the raw string output of the Redis `INFO` command into a structured JavaScript object. This library provides a programmatic way to access detailed Redis server statistics, configuration parameters, and operational metrics. The current stable version, 3.1.0, was published approximately 4-5 years ago, indicating a maintenance-oriented release cadence primarily driven by critical bug fixes or significant changes to the Redis `INFO` command's format itself. Its primary differentiation lies in its single-purpose design, offering a direct and unopinionated conversion of the `INFO` string without coupling to a full Redis client library.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates parsing a multi-section Redis INFO string and accessing specific properties from the resulting object.

const { parse } = require('redis-info');

const redisInfoString = `
# Server
redis_version:2.4.10
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d9d
redis_mode:standalone
os:Linux 5.15.0-78-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:9.4.0
process_id:1234
process_supervised:no
run_id:54321deadbeef0987654321deadbeef098765
tcp_port:6379
server_time_usec:1678886400000000
uptime_in_seconds:3600
uptime_in_days:0
hz:10
lru_clock:123456789
executable:/usr/local/bin/redis-server
config_file:/etc/redis/redis.conf

# Clients
connected_clients:1
client_recent_max_input_buffer:2
client_recent_max_output_buffer:0
blocked_clients:0

# Memory
used_memory:1048576
used_memory_human:1.00M
used_memory_rss:2097152
used_memory_rss_human:2.00M
used_memory_peak:1048576
used_memory_peak_human:1.00M
`;

const info = parse(redisInfoString);

console.log('Redis Version:', info.redis_version);
console.log('OS:', info.os);
console.log('Connected Clients:', info.connected_clients);
console.log('Memory Used Human:', info.used_memory_human);

// Example of accessing a non-existent property (returns undefined)
console.log('Replication Role (may not exist in old Redis versions):', info.role);

view raw JSON →