1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

361 Commits

Author SHA1 Message Date
99d2f489dd Update Copyright year 2018-01-24 00:21:04 +01:00
577c065900 Allow to define a File adapter using a file:// URI 2018-01-23 23:54:48 +01:00
39f12047cb Add helper method to parse URI parameter from an adapter URI 2018-01-23 23:53:31 +01:00
c194b00b34 Improve code formatting and fix Rubocop issues 2018-01-23 23:21:58 +01:00
3a8371e1b8 Fix comment typo in Rackstash::Logger 2018-01-23 23:19:45 +01:00
38a5c669a3 Allow to register complex URI schemes for Adapters
Most notably, we want to use the plus character in URI schemes. By only
checking the first character of the scheme registration, we can better
fullfil our contract and better distinguish between schemes and class
names of registered Adapters.
2018-01-22 01:11:27 +01:00
e8bf2c31bd Raise ArgumentError when trying to resolve an unknown adapter URI
If we were to fall through, undefined schemes would always end up as a
file adapter. This is generally undesired since it hides the fact that
we have not found a suitable adapter. Most of the time, this will be a
configuration error which should be reported early.

If a user still wants to create a file adapter with a filename that
looks like a URI, they can create a Rackstash::Adapter::File object
manually.
2018-01-22 01:05:06 +01:00
bdeb0534c9 Allow to set the Flow#raise_on_error setting with the same getter/setter protocol as all the other values 2018-01-12 23:34:17 +01:00
96f102875f Allow to set Flow#raise_on_error? to aid in debugging flows 2018-01-12 21:03:52 +01:00
0605fc433d Document the error_flow parameter in Flow#initialize 2018-01-12 20:38:57 +01:00
2425fdea09 Bump Rubies in Travis CI and add Ruby 2.5.0 2018-01-03 21:03:34 +01:00
7c424edfe0 Remove debug code from specs 2018-01-03 20:40:51 +01:00
65d75523c3 Ensure only valid classes can be registered as filters and encoders 2018-01-03 20:40:31 +01:00
fe44186da4 Add filter to mask of IP addresses in event fields 2018-01-03 20:39:24 +01:00
cf7587cde8 Use the registered filter names to define them in examples 2017-12-28 22:08:34 +01:00
795a8e4e2d Clarify documentation on how to define filters 2017-12-28 22:07:41 +01:00
e5c83d9ac5 Add documentation about Filter#register and Encoder#register 2017-12-21 01:42:01 +01:00
9ed350cb8d Allow fields to hold force-inspected BasicObjects 2017-12-21 01:19:10 +01:00
6eaeaedaf8 Register encoders using a ClassRegistry 2017-12-20 23:58:32 +01:00
de6b60925a Allow to define conditionals on built filters
Now you can define optional filters which only run if some condition is
true or false. This can be used to e.g. update fields depending on some
tags being present in the event.
2017-12-20 23:40:20 +01:00
a475a5c6fc Use the ClassRegistry to register filters
This removes the requirement that filters need to be defined in the
Rackstash::Filters namespace in order to be usable with a short name.
Filters can be registered with an arbitrary name.

As before, raw blocks / procs can be defined as ad-hoc filters.
2017-12-20 23:40:20 +01:00
01593a9b8b Add Rackstash::ClassRegistry to register filters and encoders
Using the ClassRegistry, we can register short names for filter and
encoder classes so that they can be specified in a shorter and more
readable way during creation of the logger.
2017-12-20 23:06:25 +01:00
1b2dd09000 Add FilterChain#push as an alias to FilterChain#<< 2017-12-20 21:39:55 +01:00
0782f31d45 Test that FilterChain#append returns the original filter chain 2017-12-20 21:39:15 +01:00
6bfe8ecb25 Provide prepend alias for FilterChain@unshift
Ruby 2.5 introduces this alias for all arrays.
2017-12-20 21:33:49 +01:00
43a303b09d Include Enumerable module into Flows 2017-12-20 21:27:12 +01:00
ad4a40413b Add example to documentation of DropIf filter 2017-12-20 18:42:21 +01:00
40e151ecb8 Rename the SkipEvent filter to DropIf to make the intention clearer 2017-12-20 18:41:40 +01:00
3fabe95013 Refactor truncate_message filter
We extract some internal emthods to make the truncation flow clearer,
i.e. first we run the selectors, then we truncate the message, then we
insert the ellipsis message (if required).
2017-12-20 18:33:20 +01:00
1671b04dfb Add Fields::Hash#each and make the Hash class an Enumerable 2017-12-12 19:58:46 +01:00
e472b7fbce Add Fields::Hash#length to emulate Hash#length 2017-12-12 19:29:28 +01:00
d382a245f3 Add Fields::Hash#fetch to emulate Hash#fetch 2017-12-12 19:26:44 +01:00
9150b2e0ac Properly test every code path for Rackstash::Helpers::Time
Even if it doesn't look like it, there might (and in fact did) lure
unexpected errors even in seemlingly obvious code-paths.
2017-12-05 19:30:39 +01:00
6ce668e09d Allow to include the event's timestamp as a message tag in the Message encoder 2017-12-05 19:07:46 +01:00
2cb0d42408 Require rackstash in rackstash/rack
This allows users to just add

    require 'rackstash/rack'

in order to load thw whole Rackstash plus the Rack integration.
2017-12-05 18:59:56 +01:00
8cdd000b0c Allow to add error details with Logger#add_error 2017-12-05 18:59:21 +01:00
26597680af Set rack.errors in the Rack::Middlware
This ensures that other middlewares whi want to log to the default
rack.errors stream will log to a sensible location instead of the usual
default of raw STDOUT or STDERR.
2017-12-05 18:55:08 +01:00
3b8e76329c Explicitly load Rackstash::Version again during coverage tests 2017-11-29 12:16:47 +01:00
969e1e8cf3 Use a plain optional argument for normalize_timestamp 2017-11-14 08:56:02 +01:00
1552728971 Update Code of Conduct to v1.4 2017-10-27 20:12:41 +02:00
57119a3266 Rename the abstract adapter base class to BaseAdapter
This avoides the name clashes (and the resulting uncertanty with name
resolution) between the base class and its containing module.
2017-10-21 16:57:01 +02:00
d721c1fc72 Singularize the Filters module
Since we are using single objects from this namespaces, it is much
more suitable to be named in singular than in plural.
2017-10-21 16:38:07 +02:00
aa37d47b8f Singularize the Adapter and Encoder modules
Since we are using single objects from these namespaces, they are much
more suitable to be named in singular than in plural.
2017-10-20 22:27:50 +02:00
e857cdb9f1 Return an existing filter instance in Filters.build 2017-10-20 20:22:38 +02:00
8db2c917c2 Fix a couple of Rubocop warnings
All of these changes are either simple formatting changes or clarify
existing meaning. None of these changes affects externally visible
behavior.
2017-10-20 19:51:11 +02:00
126e510edc Require time helper on require 'rackstash/helpers' 2017-10-20 19:43:51 +02:00
c1e3c99ab5 Do not write empty lines to IO and File adapters
If a line is completely empty, it is not useful to log it at all since
it would be invisible on the created logstream anyway. If we get passed
an empty String from the encoder, we can thus silently ignore it.
2017-10-19 23:06:45 +02:00
ca685bb13b Do not prefix an empty messages with tags
If an event's message is completely empty (usually because there was
nothing logged at all), it isn't very useful to output this bare marked
up message at all. We thus ignore it and pass it along unchanged in the
Message encoder.

Note that we still add tags for messages consisting of other whitespace
like e.g. a newline added from a formatted empty message added to a
Logger.
2017-10-19 23:03:48 +02:00
bded98fb6e Fix spelling in description of Rack::Middleware 2017-10-18 19:17:14 +02:00
c58c70febb Add Rack middleware
The middleware can be used in a Rack appliction wrap all log messages
emitted to the logger during a single request in a single emitted log
event. This ensures that all data concerning the request, including log
messages as well as additional fields and tags are logged as one single
event.

This ensures that the data is kept as a whole when the log event is
handled by later systems like Logstash. Each request can be analyzed as
a whole without having to group or parse complex multi-line log formats.
2017-10-18 00:21:43 +02:00