add json logs (#4)

This commit is contained in:
Ilya Ivanov 2023-03-01 16:18:45 +04:00 committed by GitHub
parent b85170b041
commit e9074f8a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 66 additions and 1 deletions

View File

@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends apt-utils \
ARG RIAK_VERSION
COPY files/install-riak.sh files/vars.config /
COPY files/install-riak.sh files/vars.config files/rebar.config.patch files/rebar.lock.patch files/riak.schema.patch /
RUN /install-riak.sh
# Install custom hooks

View File

@ -5,5 +5,8 @@ set -e eu
mkdir -p /opt/riak && cd /opt/riak
curl -L https://github.com/basho/riak/archive/refs/tags/riak-${RIAK_VERSION}.tar.gz -o /opt/riak.tar.gz
tar zxf /opt/riak.tar.gz --strip-components 1
patch -p0 < /riak.schema.patch
patch < /rebar.config.patch
patch < /rebar.lock.patch
make all
./rebar3 as deb release --overlay_vars /vars.config

20
files/rebar.config.patch Normal file
View File

@ -0,0 +1,20 @@
--- rebar.config.orig 2023-03-01 15:38:23.497209722 +0400
+++ rebar.config 2023-03-01 15:42:59.569322130 +0400
@@ -17,7 +17,8 @@
% {yokozuna, {git, "https://github.com/basho/yokozuna.git", {branch, "develop-3.0"}}},
- {riak_repl, {git, "https://github.com/basho/riak_repl.git", {tag, "riak_kv-3.0.12"}}}
+ {riak_repl, {git, "https://github.com/basho/riak_repl.git", {tag, "riak_kv-3.0.12"}}},
+ {lager_logstash_formatter, ".*", {git, "https://github.com/rbkmoney/lager_logstash_formatter.git", {branch, "riak-2.9"}}}
]}.
{project_plugins, [
@@ -51,6 +52,7 @@
stdlib,
lager,
lager_syslog,
+ lager_logstash_formatter,
sasl,
public_key,
ssl,

24
files/rebar.lock.patch Normal file
View File

@ -0,0 +1,24 @@
--- rebar.lock.orig 2023-03-01 15:38:30.045212676 +0400
+++ rebar.lock 2023-03-01 15:44:57.753364158 +0400
@@ -48,6 +48,10 @@
{git,"https://github.com/basho/ibrowse.git",
{ref,"cdde6fe5e80ce71e7b5570e40a45d9f862721499"}},
2},
+ {<<"jsx">>,
+ {git,"https://github.com/talentdeficit/jsx.git",
+ {ref,"47ce39f040b5da98794008bf0126c8a68760d786"}},
+ 1},
{<<"kv_index_tictactree">>,
{git,"https://github.com/martinsumner/kv_index_tictactree.git",
{ref,"4cd9ab1e20772db36f593879272dff5f02fbbeda"}},
@@ -56,6 +60,10 @@
{git,"https://github.com/erlang-lager/lager.git",
{ref,"22e62f28e5afabe90a6f31bcde367a2b5799fc94"}},
1},
+ {<<"lager_logstash_formatter">>,
+ {git,"https://github.com/rbkmoney/lager_logstash_formatter.git",
+ {ref,"687b556a05f86f0c1640db992611cec821451fa4"}},
+ 0},
{<<"lager_syslog">>,
{git,"https://github.com/basho/lager_syslog.git",
{ref,"5c8eb6ec82fa45ff0f4e456747e095654e342746"}},

18
files/riak.schema.patch Normal file
View File

@ -0,0 +1,18 @@
--- priv/riak.schema.orig 2023-03-01 15:38:54.733223673 +0400
+++ priv/riak.schema 2023-03-01 15:58:16.673602387 +0400
@@ -74,6 +74,7 @@
undefined -> [];
ErrorFilename -> [{lager_file_backend, [{file, ErrorFilename},
{level, error},
+ {formatter, lager_logstash_formatter},
{size, 10485760},
{date, "$D0"},
{count, 5}]}]
@@ -85,6 +86,7 @@
ConsoleHandler = {lager_console_backend, ConsoleLogLevel},
ConsoleFileHandler = {lager_file_backend, [{file, ConsoleLogFile},
{level, ConsoleLogLevel},
+ {formatter, lager_logstash_formatter},
{size, 10485760},
{date, "$D0"},
{count, 5}]},