2018-03-20

loadable rainerscript functions

As I said in my last post, I was working on making rainerscript functions into loadable modules.

This had multiple reasons. For one, adding new functions may add more and more dependencies, which in the end takes up a lot of memory on your computer, even if you don't plan on using any of the functions. A good example of this are hash-functions. If they were implemented to always be available, it would bloat rsyslog dependencies. However, not many users actually require hash functions, so the loss of memory would not bring any advantage.

This also led to functions (http_request being an example) not being available on many distributions, since it would require too many built-in libraries. Because of this, distributions did not provide the function, because of the dependencies (in case of http_request the curl library), causing the functions to not be usable. With the new loadable interface, this will no longer be a problem, since dedicated packages can be created. So users can decide what functions to load and can then add the needed libraries (if not already present) to their installation.

Another reason is consistency across the rsyslog project. Almost anything with the exception of script functions is loadable. Before now, making them loadable would have been unnecessary,considering that the functions are so small that loading them would take longer and make the program take up more space than just making them built in. Now however, with good options to load bigger and more complicated functions without influencing smaller systems, basically everything is loadable, as was the goal since the initial design in 2007.

However, functions can still be built in, just like omfile and other built in output modules. This is the case for all functions that existed in 8.33.1 with the exception of http_request (now available via module fmhttp). This has multiple reasons:
  1. they have a very small memory footprint 
  2. changing these functions into modules would increase the footprint, since the overhead for modules would be necessary
  3. it would break existing configurations (else missing load statements in configuration)
Reason 3. does not apply to http_request, since it has only recently been implemented (8.32.0) and hasn't been picked up by any distros at all. So it is unlikely that users will be affected.

Future blogpost will describe the implementation and usage of loadable function modules.

2018-03-05

Making rainerscript functions loadable

Right now i am working on making rsyslog script functions loadable instead of statically built in at compile time. Currently, them being built in is not a problem as they do not have many dependenies. But as more functions get added, the bulk of dependencies required for script functions grows.

One recent example is the newly added function HTTP_request(), which requires libcurl to work. This will be a problem in the future, since there are plans to expand script functions. For example, if cryptographic functions were to be implemented, they would create many new dependencies and thereby inflate rsyslog.

To counteract this, we have decided to enable the script functions to be loaded when needed instead of being built in when compiled. This process will happen in partial steps.