Skip to content

Commit

Permalink
Remove regex from promtail pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaRedHand committed Jan 18, 2024
1 parent b5a8be5 commit 83ccc69
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
22 changes: 15 additions & 7 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import Config

# Configure logging
config :logger, level: :info, truncate: :infinity
config :logger, level: :info, truncate: :infinity, utc_log: true

## TODO: we might want to enable this with a CLI flag
## Uncomment to log to a file
# # Uncomment to log to a file
# # TODO: we might want to enable this with a CLI flag
# config :logger, :default_handler,
# config: [
# file: ~c"logs/system.log",
Expand All @@ -16,10 +16,18 @@ config :logger, level: :info, truncate: :infinity
# compress_on_rotate: true
# ]

## TODO: we might want to enable this with a CLI flag
config :logger, :default_formatter,
format: "[$date $time] $metadata level=$level $message\n",
metadata: [:mfa, :registered_name]
# # NOTE: We want to log UTC timestamps, for convenience
# config :logger, utc_log: true

# config :logger, :default_formatter,
# format: {LogfmtEx, :format},
# colors: [enabled: false],
# metadata: [:mfa]

# config :logfmt_ex, :opts,
# message_key: "msg",
# timestamp_key: "ts",
# timestamp_format: :iso8601

# Configures the phoenix endpoint
config :lambda_ethereum_consensus, BeaconApi.Endpoint,
Expand Down
23 changes: 17 additions & 6 deletions metrics/promtail/promtail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,26 @@ clients:

scrape_configs:
- job_name: system
pipeline_stages:
- regex:
expression: "^\\[(?P<timestamp>[\\w: -]+)\\] (?P<mfa>\\S+) (?P<user>\\S+) \\[(?P<timestamp>[\\w:/]+\\s[+\\-]\\d{4})\\] \"(?P<action>\\S+)\\s?(?P<path>\\S+)?\\s?(?P<protocol>\\S+)?\" (?P<status_code>\\d{3}|-) (?P<size>\\d+|-)\\s?\"?(?P<referer>[^\"]*)\"?\\s?\"?(?P<useragent>[^\"]*)?\"?$"
- labels:
timestamp:
status_code:
static_configs:
- targets:
- localhost
labels:
job: lambda_ethereum_consensus
__path__: /var/log/consensus/*log
pipeline_stages:
- logfmt:
mapping:
ts:
level:
msg:
mfa:
process: registered_name
- timestamp:
format: "2006-01-02T15:04:05.000"
source: ts
- labels:
level:
mfa:
process:
- output:
source: msg

0 comments on commit 83ccc69

Please sign in to comment.