Logstash library to send information using UDP or TCP avoiding bottlenecks
$ rebar3 compile
$ rebar3 shell
In your rebar.config
(rebar3):
{deps, [
{elogstash, {git, "https://github.com/manuel-rubio/elogstash", {branch, master}}
]}
In your rebar.config
(rebar2):
{deps, [
{elogstash, ".*", {git, "https://github.com/manuel-rubio/elogstash", {branch, master}}
]}
In your Makefile
(erlang.mk):
DEPS = elogstash
dep_elogstash = git https://github.com/manuel-rubio/elogstash.git master
The configuration file only has a couple of parameters. They could be added in your code to implement the configuration from other way as well.
Using the configuration file (sys.config or app.config):
{elogstash, [
{connection, {tcp, {"localhost", 5000}}},
{max_worker, 10}
]},
The connection could be done using a string for the name (like in the example: "localhost"
) or using an IP address in the way Erlang implement them (i.e. {127,0,0,1}
).
The transports available at this moment are tcp
, udp
or file
.
In case of file
you have to configure the basename of the file instead of the host and the kind of rotation you want: hourly
, daily
or monthly
. The file could contains a path and it could be absolute or relative path but I recommend to use absolute path always.
The max_workers
is the max number of workers the pool will create. The minimum is the half so, if you configure 10 workers, the start number of connections will be 5. The file
backend force to use only 1 max worker.
The configuration could be done in the code configuring elogstash
as a dependency but only to load and then:
application:load(elogstash),
application:set_env(elogstash, connection, {{127,0,0,1}, 5000}),
application:set_env(elogstash, max_worker, 10),
elogstash:start(),
Enjoy!