Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d9cbb994
Commit
d9cbb994
authored
Jan 10, 2017
by
Ricky Niemi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up audit log formatting and code
parent
d03977ac
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
pkg/api/dataproxy.go
+5
-9
No files found.
pkg/api/dataproxy.go
View file @
d9cbb994
...
...
@@ -2,7 +2,6 @@ package api
import
(
"bytes"
"fmt"
"io/ioutil"
"net/http"
"net/http/httputil"
...
...
@@ -133,17 +132,14 @@ func ProxyDataSourceRequest(c *middleware.Context) {
}
func
outputToAuditLog
(
dataSourceType
string
,
c
*
middleware
.
Context
)
{
auditLogger
:=
log
.
New
(
"data-proxy-audit"
,
"user
Id"
,
c
.
UserId
,
"orgId"
,
c
.
OrgId
,
"u
name"
,
c
.
Login
)
auditLogger
:=
log
.
New
(
"data-proxy-audit"
,
"user
id"
,
c
.
UserId
,
"orgid"
,
c
.
OrgId
,
"user
name"
,
c
.
Login
)
bodyString
:=
""
var
body
string
if
c
.
Req
.
Request
.
Body
!=
nil
{
reqBody
:=
c
.
Req
.
Request
.
Body
buffer
,
_
:=
ioutil
.
ReadAll
(
reqBody
)
buffer
,
_
:=
ioutil
.
ReadAll
(
c
.
Req
.
Request
.
Body
)
c
.
Req
.
Request
.
Body
=
ioutil
.
NopCloser
(
bytes
.
NewBuffer
(
buffer
))
body
String
=
string
(
buffer
)
body
=
string
(
buffer
)
}
logFormat
:=
"Datasource: %s, URI: %s, Method: %s, Body: %s"
auditLogger
.
Info
(
fmt
.
Sprintf
(
logFormat
,
dataSourceType
,
c
.
Req
.
RequestURI
,
c
.
Req
.
Request
.
Method
,
bodyString
))
auditLogger
.
Info
(
"Proxying incoming request"
,
"datasource"
,
dataSourceType
,
"uri"
,
c
.
Req
.
RequestURI
,
"method"
,
c
.
Req
.
Request
.
Method
,
"body"
,
body
)
}
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