summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorMayra Cabrera <mcabrera@gitlab.com>2019-05-24 00:45:02 +0000
committerStan Hu <stanhu@gmail.com>2019-05-24 00:45:02 +0000
commited8ebc635a06380e04f2e82df6e65095314a54d2 (patch)
tree20f6db06d89c676cdd54e8137ee180e426eb7e7e /config
parentd64e6cabc71beaba5dc726aad76050ae61305016 (diff)
downloadgitlab-ce-ed8ebc635a06380e04f2e82df6e65095314a54d2.tar.gz
Changes RackAttack logger to use structured logs
Creates a new filename to register auth logs. This change should allow SRE's queries to make better queries through logging infrastructure. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54528
Diffstat (limited to 'config')
-rw-r--r--config/database.yml.example0
-rw-r--r--config/initializers/rack_attack_logging.rb10
2 files changed, 9 insertions, 1 deletions
diff --git a/config/database.yml.example b/config/database.yml.example
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/config/database.yml.example
diff --git a/config/initializers/rack_attack_logging.rb b/config/initializers/rack_attack_logging.rb
index 8bb9ea29c33..2a3fdc8de5f 100644
--- a/config/initializers/rack_attack_logging.rb
+++ b/config/initializers/rack_attack_logging.rb
@@ -1,7 +1,15 @@
+# frozen_string_literal: true
+#
# Adds logging for all Rack Attack blocks and throttling events.
ActiveSupport::Notifications.subscribe('rack.attack') do |name, start, finish, request_id, req|
if [:throttle, :blacklist].include? req.env['rack.attack.match_type']
- Rails.logger.info("Rack_Attack: #{req.env['rack.attack.match_type']} #{req.ip} #{req.request_method} #{req.fullpath}")
+ Gitlab::AuthLogger.error(
+ message: 'Rack_Attack',
+ env: req.env['rack.attack.match_type'],
+ ip: req.ip,
+ request_method: req.request_method,
+ fullpath: req.fullpath
+ )
end
end