Source Code
- Go to your cloned repo:
cd /path/to/watchlog-agent vim integration.json - Locate the Redis config:
{ "service": "redis", "monitor": false, "host": "127.0.0.1", "port": "6379", "username": "", "password": "", "tls": false }
3. Set `"monitor"` to `true` and update the credentials:
```diff
- "monitor": false
+ "monitor": true
Redis 6+ with an ACL user takes both username and password; a requirepass-only server takes password alone. 4. Restart the agent:
pm2 restart watchlog-agent
Prerequisite
redis-cli 6.2+ must be on PATH — that is when --json arrived, and the parsers depend on it. The agent probes for it and fails with a clear message rather than collecting nothing.
redis-cli --version
Run the collector directly
node -e "
const list = require('./integration.json');
const cfg = list.find(i => i.service === 'redis');
require('./app/integrations/redis/index').collect(cfg, (err, res) => {
if (err) return console.error('failed:', err.message);
const a = res.advanced;
console.log('version :', a.server.version, '| mode:', a.server.mode, '| role:', a.server.role);
console.log('memory :', a.memory.usedMemory, 'limit configured:', a.memory.memoryLimitConfigured);
console.log('commands :', (a.commands || []).length);
console.log('slowlog :', (a.slowlog || []).length);
console.log('keyspace :', (a.keyspace || []).length);
});
"
Running the tests
The Redis parsers and the argument sanitizer are covered by the agent's test suite, which needs no live server:
npm test
The sanitizer tests are the important ones — they assert what must not come out, so a failure there is a data leak rather than a cosmetic bug.
Development notes
- The advanced collector is
app/integrations/redis/index.js; the legacy one isapp/integrations/redis.jsbeside it. Require the advanced one by full path. --no-rawoverrides--json. Passing both makesredis-clifall back to the human-readable1) 1) (integer) 0format, which the SLOWLOG and CONFIG parsers cannot read. Never add it.CONFIG GETreturns a JSON object under RESP3 and a flat array otherwise. Both shapes must be accepted.maxmemory = 0means no limit. ReturnmemoryLimitConfigured: falserather than a fake percentage against a limit that does not exist.KEYSandOFFSETare InfluxQL reserved words and appear naturally in keyspace and replication queries — every alias inredisAdvanced.jsmust stay quoted, or the endpoint returns a runtime-only 500.- Redis slowlog ids restart at 0 when the server restarts, so the id alone is not unique over time. Document ids combine it with the run id.
- Argument redaction is allow-list shaped, not deny-list shaped: an argument is redacted unless it is provably safe. Adding a new "safe" category means proving it cannot carry a value, not assuming it.
- Commands are sent newline-delimited on stdin with
ECHOmarkers between them, and the output is split back positionally.SECTION_NAMESmust stay in the same order as the pushes inbuildCommandScript— the two are read by index.
