Changelog for 7.6.3 (v7-stable)
Version 7.6.3 [v7.6-stable] 2014-03-27
- add capability to override GnuTLS path in build process
Thanks to Clayton Shotwell for the patch - support for librelp 1.2.5
Support new return states of librelp 1.2.5 to emit better error messages. For obvious reasons, librelp 1.2.5 is now required. - bugfix: ompipe used invalid default template
This is a regression from an old change (didn’t track it down precisely, but over a year ago). It used the Forwarding template instead of the file template (so we have a full syslog header). This fix corrects it back to previous behaviour, but new scripts that used the wrong format may now need to have the RSYSLOG_ForwardingFormat template explicitely be applied.
closes: https://github.com/rsyslog/rsyslog/issues/50 - bugfix: ompipe did emit many suspension messages for /dev/xconsole
(hopefully now) closes: https://github.com/rsyslog/rsyslog/issues/35
When it was present, but nobody reading from it. The problem is the way the rsyslog v7 engine tries to resolve failures in outputs. It does some retries, and along those lines some state information gets lost and it is close to impossible to retain it. However, the actual root problem is that ompipe does not reliably detect if it is able to recover. The problem here is that it actually does not know this before it does an actual write. These two things together mess up the logic that suppresses invalid resumption/suspension messages (actually, the plugin switches state really that often). Nevertheless, the prime problem with /dev/xconsole (and probably most other pipes as well) is that it gets full. So I have now added code that checks, during resume processing, if the pipe is writable. If it is not, resume is deferred. That should address the case.
Performance Tuning&Tests for the Elasticsearch Output
Original post: Rsyslog 8.1 Elasticsearch Output Performance by @Sematext
Version 8 brings major changes in rsyslog’s core – see Rainer’s presentation about it for more details. Those changes should give outputs better performance, and the Elasticsearch one should benefit a lot. Since we’re using rsyslog and Elasticsearch in Sematext‘s own log analytics product, Logsene, we had to take the new version for a spin.
The Weapon and the Target
For testing, we used a good-old i3 laptop, with 8GB of RAM. We generated 20 million logs, sent them to rsyslog via TCP and from there to Elasticsearch in the Logstash format, so they can get explored with Kibana. The objective was to stuff as many events per second into Elasticsearch as possible.
Rsyslog Architecture Overview
In order to tweak rsyslog effectively, one needs to understand its architecture, which is not that obvious (although there’s an ongoing effort to improve the documentation). The gist of it its architecture represented in the figure below.
- you have input modules taking messages (from files, TCP/UDP, journal, etc.) and pushing them to a main queue
- one or more main queue threads take those events and parse them. By default, they parse syslog formats (RFC-3164, RFC-5424 and various derivatives), but you can configure rsyslog to use message modifier modules to do additional parsing (e.g. CEE-formatted JSON messages). Either way, this parsing generates structured events, made out of properties
- after parsing, the main queue threads push events to the action queue. Or queues, if there are multiple actions and you want to fan-out
- for each defined action, one or more action queue threads takes properties from events according to templates, and makes messages that would be sent to the destination. In Elasticsearch’s case, a template should make Elasticsearch JSON documents, and the destination would be the REST API endpoint
There are two more things to say about rsyslog’s architecture before we move on to the actual test:
- you can have multiple independent flows (like the one in the figure above) in the same rsyslog process by using rulesets. Think of rulesets as swim-lanes. They’re useful for example when you want to process local logs and remote logs in a completely separate manner
- queues can be in-memory, on disk, or a combination called disk-assisted. Here, we’ll use in-memory because they’re the fastest. For more information about how queues work, take a look here
Configuration
To generate messages, we used tcpflood, a small and light tool that’s part of rsyslog’s testbench. It generates messages and sends them over to the local syslog via TCP.
Rsyslog took received those messages with the imtcp input module, queued them and forwarded them to Elasticsearch 0.90.7, which was also installed locally. We also tried with Elasticsearch 1.0 and got the same results (see below).
The flow of messages in this test is represented in the following figure:
The actual rsyslog config is listed below (in the new configuration format). It can be tuned further (for example by using the multithreaded imptcp input module), but we didn’t get significant improvements in this particular scenario.
module(load="imtcp") # TCP input module module(load="omelasticsearch") # Elasticsearch output module input(type="imtcp" port="13514") # where to listen for TCP messages main_queue( queue.size="1000000" # capacity of the main queue queue.dequeuebatchsize="1000" # process messages in batches of 1000 and move them to the action queues queue.workerthreads="2" # 2 threads for the main queue ) # template to generate JSON documents for Elasticsearch in Logstash format template(name="plain-syslog" type="list") { constant(value="{") constant(value="\"@timestamp\":\"") property(name="timereported" dateFormat="rfc3339") constant(value="\",\"host\":\"") property(name="hostname") constant(value="\",\"severity\":\"") property(name="syslogseverity-text") constant(value="\",\"facility\":\"") property(name="syslogfacility-text") constant(value="\",\"syslogtag\":\"") property(name="syslogtag" format="json") constant(value="\",\"message\":\"") property(name="msg" format="json") constant(value="\"}") } action(type="omelasticsearch" template="plain-syslog" # use the template defined earlier searchIndex="test-index" bulkmode="on" # use the Bulk API queue.dequeuebatchsize="5000" # ES bulk size queue.size="100000" # capacity of the action queue queue.workerthreads="5" # 5 workers for the action action.resumeretrycount="-1" # retry indefinitely if ES is unreachable )
You can see from the configuration that:
- both main and action queues have a defined size in number of messages
- both have number of threads that deliver messages to the next step. The action needs more because it has to wait for Elasticsearch to reply
- moving of messages from the queues happens in batches. For the Elasticsearch output, the batch of messages is sent through the Bulk API, which makes queue.dequeuebatchsize effectively the bulk size
Results
We started with default Elasticsearch settings. Then we tuned them to leave rsyslog with a more significant slice of the CPU. We monitored the indexing rate with SPM for Elasticsearch. Here are the average results over 20 million indexed events:
- with default Elasticsearch settings, we got 8,000 events per second
- after setting Elasticsearch up more production-like (5 second refresh interval, increased index buffer size, translog thresholds, etc), and the throughput went up to average of 20,000 events per second
- in the end, we went berserk and used in-memory indices, updated the mapping to disable any storing or indexing for any field, to have Elasticsearch do as little work as possible and make room for rsyslog. Got an average of 30,000 events per second. In this scenario, rsyslog was using between 1 and 1.5 of the 4 virtual CPU cores, with tcpflood using 0.5 and Elasticsearch using from 2 to 2.5
Conclusion
20K EPS on a low-end machine with production-like configuration means Elasticsearch is quick at indexing. This is very good for logs, where you typically have lots of messages being generated, compared to how often you search.
If you need some tool to ship your logs to Elasticsearch with minimum overhead, rsyslog version 8 may well be your best bet.
Related posts:
librelp 1.2.5
librelp 1.2.5 [download]
This version of librelp allows to use anonymous TLS on platforms where GnuTLS misses certificate verification function. This permits to use at least anon TLS on platforms like RHEL and CENTOS 6.
Version 1.2.5 – 2014-03-20
– permit to use anonymous TLS on platforms where GnuTLS misses
certificate verification function. This permits to use at least
anon TLS on platforms like RHEL and CENTOS 6.
sha256sum: 358b2de82c9aebd4efcbab5e1ff212477fb8fa89543dbeded61aa46a23dcf12b
LibLogging 1.0.3 released
liblogging 1.0.3 [download]
We have released liblogging 1.0.3.
v1.0.3 2014-03-18
– fix build problem in Ubuntu 10.04
Thanks to Assaf Gordon for reporting
See: https://github.com/rsyslog/liblogging/issues/11
– do not override user varibale CFLAGS
Thanks to Thomas D. for reporting this problem and suggesting a solution.
closes: https://github.com/rsyslog/liblogging/issues/15
– make liblogging-rfc3195 not export private symbols
Thanks to Michael Biebl for his help in getting this right.
– explain that stdlog_log() return code usually most not be checked
(if same level of reliability like syslog(3) is desired)
rsyslog 7.6.2 (v7-stable) released
http://www.rsyslog.com/changelog-for-7-6-2-v7-stable/
Download:
http://www.rsyslog.com/downloads/download-v7-stable/
As always, feedback is appreciated.
Best regards,
Florian Riedl
Changelog for 7.6.2 (v7-stable)
Version 7.6.2 [v7.6-stable] 2014-03-17
- support for librelp 1.2.4
This was necessary due to the problems with librelp 1.2.3 API stability.
We now use the new native 1.2.4 APIs to learn about the state of librelp’s TLS support.
For obvious reasons, librelp 1.2.4 is now required.
librelp 1.2.4
librelp 1.2.4 [download]
This version of librelp is a correction for the API/ABI change in v1.2.3. Everything else stays the same.
Version 1.2.4 – 2014-03-17
– correct API/ABI change in 1.2.3
My reasoning was flawed, and we could run into problems with
apps that required the new version but could not detect that an
older one was installed.
Thanks to Michael Biebl for pointing this out.
What we have done is:
– revert back to previous state (return void)
* relpSrvEnableTLS();
* relpSrvEnableTLSZip();
These functions are now deprecated.
– introduce new functions that return a state
* relpSrvEnableTLS2();
* relpSrvEnableTLSZip2();
sha256sum: cf4f26f9a75991eedf3eaf414280c8da3532c38e619a465d23008c714f5c1cf1
rsyslog 7.6.1 (v7-stable) released
This releases is a recommended update for all users of the 7.6 branch.
ChangeLog:
http://www.rsyslog.com/changelog-for-7-6-1-v7-stable/
Download:
http://www.rsyslog.com/rsyslog-7-6-1-v7-stable/
As always, feedback is appreciated.
Best regards,
Florian Riedl
rsyslog 7.6.1 (v7-stable)
Download file name: rsyslog 7.6.1 (stable)
rsyslog 7.6.1 (stable)
sha256 hash: 357f089d866c351d5fe5b7139fa85b
Author: Rainer Gerhards (rgerhards@adiscon.com)
Version: 7.6.1 File size: 3.05 MB
Changelog for 7.6.1 (v7-stable)
Version 7.6.1 [v7.6-stable] 2014-03-13
- added “action.reportSuspension” action parameter This now permits to control handling on a per-action basis rather to the previous “global setting only”.
- “action resumed” message now also specifies module type which makes troubleshooting a bit easier. Note that we cannot output all the config details (like destination etc) as this would require much more elaborate code changes, which we at least do not like to do in the stable version.
- better and more consistent action naming, action queues now always contain the word “queue” after the action name – add support for “tls-less” librelp we now require librelp 1.2.3, as we need the new error code definition See also: https://github.com/rsyslog/
librelp/issues/1 - build system improvements
- autoconf subdir option
- support for newer json-c packages Thanks to Michael Biebl for the patches.
- imjournal enhancements:
- log entries with empty message field are no longer ignored
- invalid facility and severity values are replaced by defaults
- new config parameters to set default facility and severity Thanks to Tomas Heinrich for implementing this
- bugfix: ompipe did resume itself even when it was still in error See: https://github.com/rsyslog/
rsyslog/issues/35 Thanks to github user schplat for reporting - bugfix: “action xxx suspended” did report incorrect error code
- bugfix: ommongodb’s template parameter was mandatory but should have been optional Thanks to Alain for the analysis and the patch.
- bugfix: only partial doc was put into distribution tarball Thanks to Michael Biebl for alerting us. see also: https://github.com/rsyslog/
rsyslog/issues/31 - bugfix: async ruleset did process already-deleted messages Thanks to John Novotny for the patch.