Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
a9f03a72
Unverified
Commit
a9f03a72
authored
8 years ago
by
Cameron Sparr
Browse files
Options
Downloads
Patches
Plain Diff
Mask username/password from error messages
closes #1980
parent
7fc57812
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
plugins/inputs/elasticsearch/elasticsearch.go
+16
-3
16 additions, 3 deletions
plugins/inputs/elasticsearch/elasticsearch.go
with
17 additions
and
3 deletions
CHANGELOG.md
+
1
−
0
View file @
a9f03a72
...
@@ -42,6 +42,7 @@ plugins, not just statsd.
...
@@ -42,6 +42,7 @@ plugins, not just statsd.
-
[
#1898
](
https://github.com/influxdata/telegraf/issues/1898
)
: Support negative statsd counters.
-
[
#1898
](
https://github.com/influxdata/telegraf/issues/1898
)
: Support negative statsd counters.
-
[
#1921
](
https://github.com/influxdata/telegraf/issues/1921
)
: Elasticsearch cluster stats support.
-
[
#1921
](
https://github.com/influxdata/telegraf/issues/1921
)
: Elasticsearch cluster stats support.
-
[
#1942
](
https://github.com/influxdata/telegraf/pull/1942
)
: Change Amazon Kinesis output plugin to use the built-in serializer plugins.
-
[
#1942
](
https://github.com/influxdata/telegraf/pull/1942
)
: Change Amazon Kinesis output plugin to use the built-in serializer plugins.
-
[
#1980
](
https://github.com/influxdata/telegraf/issues/1980
)
: Hide username/password from elasticsearch error log messages.
### Bugfixes
### Bugfixes
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/elasticsearch/elasticsearch.go
+
16
−
3
View file @
a9f03a72
...
@@ -4,6 +4,7 @@ import (
...
@@ -4,6 +4,7 @@ import (
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"net/http"
"net/http"
"regexp"
"sync"
"sync"
"time"
"time"
...
@@ -16,6 +17,9 @@ import (
...
@@ -16,6 +17,9 @@ import (
"strings"
"strings"
)
)
// mask for masking username/password from error messages
var
mask
=
regexp
.
MustCompile
(
`https?:\/\/\S+:\S+@`
)
// Nodestats are always generated, so simply define a constant for these endpoints
// Nodestats are always generated, so simply define a constant for these endpoints
const
statsPath
=
"/_nodes/stats"
const
statsPath
=
"/_nodes/stats"
const
statsPathLocal
=
"/_nodes/_local/stats"
const
statsPathLocal
=
"/_nodes/_local/stats"
...
@@ -149,7 +153,7 @@ func (e *Elasticsearch) Gather(acc telegraf.Accumulator) error {
...
@@ -149,7 +153,7 @@ func (e *Elasticsearch) Gather(acc telegraf.Accumulator) error {
e
.
client
=
client
e
.
client
=
client
}
}
errChan
:=
errchan
.
New
(
len
(
e
.
Servers
))
errChan
:=
errchan
.
New
(
len
(
e
.
Servers
)
*
3
)
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
wg
.
Add
(
len
(
e
.
Servers
))
wg
.
Add
(
len
(
e
.
Servers
))
...
@@ -172,17 +176,26 @@ func (e *Elasticsearch) Gather(acc telegraf.Accumulator) error {
...
@@ -172,17 +176,26 @@ func (e *Elasticsearch) Gather(acc telegraf.Accumulator) error {
// Always gather node states
// Always gather node states
if
err
:=
e
.
gatherNodeStats
(
url
,
acc
);
err
!=
nil
{
if
err
:=
e
.
gatherNodeStats
(
url
,
acc
);
err
!=
nil
{
err
=
fmt
.
Errorf
(
mask
.
ReplaceAllString
(
err
.
Error
(),
"http(s)://XXX:XXX@"
))
errChan
.
C
<-
err
errChan
.
C
<-
err
return
return
}
}
if
e
.
ClusterHealth
{
if
e
.
ClusterHealth
{
url
=
s
+
"/_cluster/health?level=indices"
url
=
s
+
"/_cluster/health?level=indices"
e
.
gatherClusterHealth
(
url
,
acc
)
if
err
:=
e
.
gatherClusterHealth
(
url
,
acc
);
err
!=
nil
{
err
=
fmt
.
Errorf
(
mask
.
ReplaceAllString
(
err
.
Error
(),
"http(s)://XXX:XXX@"
))
errChan
.
C
<-
err
return
}
}
}
if
e
.
ClusterStats
&&
e
.
isMaster
{
if
e
.
ClusterStats
&&
e
.
isMaster
{
e
.
gatherClusterStats
(
s
+
"/_cluster/stats"
,
acc
)
if
err
:=
e
.
gatherClusterStats
(
s
+
"/_cluster/stats"
,
acc
);
err
!=
nil
{
err
=
fmt
.
Errorf
(
mask
.
ReplaceAllString
(
err
.
Error
(),
"http(s)://XXX:XXX@"
))
errChan
.
C
<-
err
return
}
}
}
}(
serv
,
acc
)
}(
serv
,
acc
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment