BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
190fae5f
Commit
190fae5f
authored
Jul 28, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-augment-lograge-output' into 'master'
Add remote IP, user ID and username to JSON lograge output See merge request !13147
parents
3f1b7b88
96c4a15e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
application_controller.rb
app/controllers/application_controller.rb
+10
-0
lograge.rb
config/initializers/lograge.rb
+4
-1
No files found.
app/controllers/application_controller.rb
View file @
190fae5f
...
...
@@ -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
...
...
config/initializers/lograge.rb
View file @
190fae5f
...
...
@@ -14,7 +14,10 @@ unless Sidekiq.server?
config
.
lograge
.
custom_options
=
lambda
do
|
event
|
{
time:
event
.
time
.
utc
.
iso8601
(
3
),
params:
event
.
payload
[
:params
].
except
(
*
%w(controller action format)
)
params:
event
.
payload
[
:params
].
except
(
*
%w(controller action format)
),
remote_ip:
event
.
payload
[
:remote_ip
],
user_id:
event
.
payload
[
:user_id
],
username:
event
.
payload
[
:username
]
}
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment