mike Dumass
mike Dumass

Reputation: 93

Using redis with logstash

I'm wondering what are the pros and cons of using redis as a broker in an infrastructure?

At the moment, all my agents are sending to a central NXLog server which proxies the requests to logstash --> ES.

What would I gain by using a redis server in between my nxlog collector and logstash? To me, it seems pointless as nxlog has already good mem and disk buffers in case logstash is down.

What would I gain?

Thank you

Upvotes: 4

Views: 3426

Answers (5)

Christian Kniep
Christian Kniep

Reputation: 71

I started using redis because I felt that it would separat the input and the filter part. At least during periodes in which I change the configuration a lot.

As you know if you change the logstash configuration you have to restart the thing. All clients (in my case via syslog) are doomed to reconnect to the logstash daemon when he is back in business.

By putting an indexer in front which holds the relativly static input configuration and pusing everything to redis I am able to restart logstash without causing hickups throughout the datacenter. I encountered some issues, because our developers hadn't found time (yet) to reduce the amount of useless logs send to syslog, thus overflowing the server. Before we had logstash they overflowed the disk space for logs - more general issue though... :)

Upvotes: 1

Nabil
Nabil

Reputation: 1811

On a heavy load : calling ES (HTTP) directly can be dangerous and you can have problems if ES break down .

Redis can handle More (Much more) Write request and send it in asynch logic to ES(HTTP).

Upvotes: 1

Alain Collins
Alain Collins

Reputation: 16362

As we built our ELK infrastructure, we originally had a lot of problems with the logstash indexer (reading from redis). Redis would back up and eventually die. I believe this was because, in the hope of not losing log files, redis was configured to persist the cache to disk once in a while. When the queue got "too large" (but still within available disk space), redis would die, taking all of the cached entries with it.

If this is the best redis can do, I wouldn't recommend it.

Fortunately, we were able to resolve the issues with the indexer, which typically kept the redis queue empty. We set our monitoring to alert quickly when the queue did back up, and it was a good sign that the indexer was unhappy again.

Hope that helps.

Upvotes: 0

user3195649
user3195649

Reputation: 437

When using Logstash with Redis, you can configure Redis to only store all the log entries in memory which would like a in memory queue (like memcache).

You mat come to the point where the number of logs sent will not be processed by Logstash and it can bring down your system on constant basis (observed in our environment).

If you feel Redis is an overhead for your disk, you can configure it to store all the logs in memory until they are processed by logstash.

Upvotes: 0

thorhs
thorhs

Reputation: 1

When used with Logstash, Redis acts as a message queue. You can have multiple writers and multiple readers.

By using Redis (or any other queueing service) allows you to scale Logstash horizontaly by adding more servers to the 'cluster'. This will not matter for small operations but can be extremely useful for larger installations.

Upvotes: 0

Related Questions