Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Riak Kernel Logger Support

This repository contains configuration and operational support elements for logging with the OTP Kernel Logger.

Sample configuration using this application's features can be found in the logger.config file.

Complete documentation of configuration options is available in the EDoc Documentation.

Logger filters are defined in the riak_logger module.

JSON Formatter

A JSON log formatter is defined in the riak_log_json_formatter module

The JSON formatter generates a one-line JSON object per log event.

Using the default configuration, events generated with the logging macros will generally output the following JSON fields:

{
   "file" : "<application>/src/<module>.erl",
   "gl" : "<originating Erlang group leader pid>",
   "level" : "INFO",
   "line" : <integer line number in file>,
   "message" : "<formatted log message>",
   "mfa" : "<module>:<function>/<arity>",
   "ospid" : <integer OS process ID of the ERTS VM>,
   "proc" : "<originating Erlang process pid>",
   "timestamp" : "2025-01-27T17:47:11.554Z"
}

The formatter is highly configurable (see the application documentation), but the default configuration is likely suitable for most use cases. As such, it can generally be configured with a standard log file writer as follows in advanced.config:

%% /etc/riak/advanced.config
[
    {kernel, [
        {logger, [
            %% Records ALL events to JSON log
            {handler, json_log, logger_std_h, #{
                level => all,
                config => #{
                    compress_on_rotate => false,
                    file => "{{platform_log_dir}}/json/riak-log.json",
                    file_check => 100,
                    max_no_bytes => 1048576,
                    max_no_files => 10
                },
                filter_default => log,
                filters => [],
                formatter => {riak_log_json_formatter, #{
                    %% Defaults should be suitable for most use cases.
                }}
            }}
        ]}
    ]}
]

Bugs

What??? No way ...

Yeah, you should probably file an issue.

About

Riak 3.2+ Kernel Logger Support.

Resources

Stars

2 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages