diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-28 08:30:26 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-28 08:30:26 +0000 |
commit | 190fae5f0cef11d68c7385be0c4013931796f958 (patch) | |
tree | cce10831d4b6b68b0b85787360e81e1a2cb27b8c /app/controllers | |
parent | 3f1b7b88c8d4f19a10920ad1629fc440af584d08 (diff) | |
parent | 96c4a15eae9b93a2bfb512309e860da50d2e2636 (diff) | |
download | gitlab-ce-190fae5f0cef11d68c7385be0c4013931796f958.tar.gz |
Merge branch 'sh-augment-lograge-output' into 'master'
Add remote IP, user ID and username to JSON lograge output
See merge request !13147
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 43462b13903..d14b1dbecf6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -70,6 +70,16 @@ class ApplicationController < ActionController::Base protected + def append_info_to_payload(payload) + super + payload[:remote_ip] = request.remote_ip + + if current_user.present? + payload[:user_id] = current_user.id + payload[:username] = current_user.username + end + end + # This filter handles both private tokens and personal access tokens def authenticate_user_from_private_token! token = params[:private_token].presence || request.headers['PRIVATE-TOKEN'].presence |