README
spawn-pq
nodejs pq spawner (native rust binding on the way)
Requirements
cargo install pq --git https://github.com/iximiuz/pq
Usage
Do not use this. It's for testing with pq
in preparation for the native binding.
CLI
pq.js "query" parameters
Wrapper
var init = require('spawn-pq')
var args = process.argv.slice(2);
var pq = init(args);
pq.stdout.pipe(process.stdout);
process.stdin.pipe(pq.stdin);
Test
cat test/inputweb | ./pq.js "/[^\\s]+[^\\[]+\\[([^\\]]+)]\\s+\"([^\\s]+)[^\"]*?\"\\s+(\\d+).*/ | map { .0:ts \"%d/%b/%Y:%H:%M:%S\", .1 as method, .2 as status_code } | select count_over_time(status_code[3s]) | to_promapi" --interval 1s
cat test/inputagg | ./pq.js "/([^\\s]+)\\s(\\w+)\\s(\\d+)\\s(\\w+)\\s(\\w+)/ | map {.0:ts \"%Y-%m-%dT%H:%M:%S\", .1 as name, .3 as country, .4 as job, .2 as age} | select min(age) without(name,job) | to_promapi" --interval 1s
cat test/inputcount | ./pq.js "/[^\\[]+\\[([^\\s]+).+?]\\s+\"([^\\s]+)[^\"]*?\"\\s+(\\d+)\\s+(\\d+).*/ | map {.0:ts \"%d/%b/%Y:%H:%M:%S\", .1 as method, .3 as content_len} | select count_over_time(__line__[1s]) | to_promapi"