Adds log rotation

Why:

* To limit the total size of the logs retained while still allowing
analysis of recent events.
* Issue link: n/a

This change addresses the need by:

* Editing the logger backends to do file rotation every 50mb and keep
the last 19 log files per logger backend. 50mb * 20 = ~1gb
pull/958/head
Sebastian Abondano 6 years ago
parent bc10654663
commit 1cbaafd894
  1. 3
      apps/block_scout_web/config/prod.exs
  2. 3
      apps/ethereum_jsonrpc/config/prod.exs
  3. 3
      apps/explorer/config/prod.exs
  4. 6
      apps/indexer/config/prod.exs
  5. 7
      config/prod.exs

@ -26,4 +26,5 @@ config :block_scout_web, BlockScoutWeb.Endpoint,
config :logger, :block_scout_web,
level: :info,
path: Path.absname("logs/prod/block_scout_web.log")
path: Path.absname("logs/prod/block_scout_web.log"),
rotate: %{max_bytes: 52_428_800, keep: 19}

@ -2,4 +2,5 @@ use Mix.Config
config :logger, :ethereum_jsonrpc,
level: :info,
path: Path.absname("logs/prod/ethereum_jsonrpc.log")
path: Path.absname("logs/prod/ethereum_jsonrpc.log"),
rotate: %{max_bytes: 52_428_800, keep: 19}

@ -11,7 +11,8 @@ config :explorer, Explorer.Repo,
config :logger, :explorer,
level: :info,
path: Path.absname("logs/prod/explorer.log")
path: Path.absname("logs/prod/explorer.log"),
rotate: %{max_bytes: 52_428_800, keep: 19}
variant =
if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do

@ -2,12 +2,14 @@ use Mix.Config
config :logger, :indexer,
level: :info,
path: Path.absname("logs/prod/indexer.log")
path: Path.absname("logs/prod/indexer.log"),
rotate: %{max_bytes: 52_428_800, keep: 19}
config :logger, :indexer_token_balances,
level: :debug,
path: Path.absname("logs/prod/indexer/token_balances/error.log"),
metadata_filter: [fetcher: :token_balances]
metadata_filter: [fetcher: :token_balances],
rotate: %{max_bytes: 52_428_800, keep: 19}
variant =
if is_nil(System.get_env("ETHEREUM_JSONRPC_VARIANT")) do

@ -6,6 +6,9 @@ config :logger, :console, level: :info
config :logger, :ecto,
level: :info,
path: Path.absname("logs/prod/ecto.log")
path: Path.absname("logs/prod/ecto.log"),
rotate: %{max_bytes: 52_428_800, keep: 19}
config :logger, :error, path: Path.absname("logs/prod/error.log")
config :logger, :error,
path: Path.absname("logs/prod/error.log"),
rotate: %{max_bytes: 52_428_800, keep: 19}

Loading…
Cancel
Save