redis-pipe
redis-pipe allows you to treat Redis Lists
as if they were Unix pipes.
It basically connects stdin
and stdout
with LPUSH
and LPOP
.
Install
Simply download the release and make it executable (prebuilt binaries are for Linux only for now).
wget https://github.com/lukasmartinelli/redis-pipe/releases/download/v1.4/redis-pipe
chmod +x redis-pipe
./redis-pipe --help
Build
Install dependencies
go get github.com/andrew-d/go-termutil
go get github.com/docopt/docopt-go
go get github.com/garyburd/redigo/redis"
Build binary
go build redis-pipe.go
How it works
Configuration
Set the REDIS_HOST
and REDIS_PORT
environment variables for
easy configuration or pass --host
and --port
arguments.
Writing from stdin to Redis List
Pipe in value to redis-pipe
and it will LPUSH
them to the Redis List.
echo "hi there" | ./redis-pipe greetings
Reading from Redis List to stdout
If you call redis-pipe
with a tty attached it will LPOP
all values
from the Redis List and write them to stdout.
./redis-pipe greetings
You can also limit the amount of values popped from the list.
./redis-pipe --count 100 greetings
Support for blocking mode with BLPOP
is not supported yet.
Examples
Centralized Logging
In this sample we pipe the syslog to a Redis List called log
.
tail -f /var/log/syslog | ./redis-pipe logs
You can now easily collect all the syslogs of your machines
on a single server.
./redis-pipe logs > logs.txt