Skip to content

Commit 8fa61aa

Browse files
committed
Remove metrics endpoint in winlogbeat
The metrics endpoint is replaced by the http endpoint in libbeat. See elastic#3717
1 parent 4446527 commit 8fa61aa

File tree

7 files changed

+9
-145
lines changed

7 files changed

+9
-145
lines changed

CHANGELOG.asciidoc

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
3636
- Remove deprecated geoip. {pull}3766[3766]
3737

3838
*Winlogbeat*
39+
- Remove metrics endpoint. Replaced by http endpoint in libbeat (#3717). {pull}x[x]
3940

4041

4142
==== Bugfixes

winlogbeat/_meta/beat.full.yml

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
# in the directory in which it was started.
1515
#winlogbeat.registry_file: .winlogbeat.yml
1616

17-
# Diagnostic metrics that can retrieved through a web interface if a
18-
# bindaddress value (host:port) is specified. The web address will be
19-
# http://<bindaddress>/debug/vars
20-
#winlogbeat.metrics:
21-
# bindaddress: 'localhost:8123'
22-
2317
# event_logs specifies a list of event logs to monitor as well as any
2418
# accompanying options. The YAML data type of event_logs is a list of
2519
# dictionaries.

winlogbeat/beater/winlogbeat.go

+1-19
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ package beater
77
import (
88
"expvar"
99
"fmt"
10-
"net"
11-
"net/http"
1210
"sync"
1311
"time"
1412

@@ -35,8 +33,7 @@ func init() {
3533

3634
// Debug logging functions for this package.
3735
var (
38-
debugf = logp.MakeDebug("winlogbeat")
39-
memstatsf = logp.MakeDebug("memstats")
36+
debugf = logp.MakeDebug("winlogbeat")
4037
)
4138

4239
// Time the application was started.
@@ -115,21 +112,6 @@ func (eb *Winlogbeat) setup(b *beat.Beat) error {
115112
return err
116113
}
117114

118-
if config.Metrics.BindAddress != "" {
119-
bindAddress := config.Metrics.BindAddress
120-
sock, err := net.Listen("tcp", bindAddress)
121-
if err != nil {
122-
return err
123-
}
124-
go func() {
125-
logp.Info("Metrics hosted at http://%s/debug/vars", bindAddress)
126-
err := http.Serve(sock, nil)
127-
if err != nil {
128-
logp.Warn("Unable to launch HTTP service for metrics. %v", err)
129-
}
130-
}()
131-
}
132-
133115
return nil
134116
}
135117

winlogbeat/config/config.go

-44
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ package config
33

44
import (
55
"fmt"
6-
"net"
76
"sort"
8-
"strconv"
97
"strings"
108

119
"github.com/joeshaw/multierror"
@@ -74,7 +72,6 @@ func (s Settings) Validate() error {
7472
// WinlogbeatConfig contains all of Winlogbeat configuration data.
7573
type WinlogbeatConfig struct {
7674
EventLogs []map[string]interface{} `config:"event_logs"`
77-
Metrics MetricsConfig `config:"metrics"`
7875
RegistryFile string `config:"registry_file"`
7976
}
8077

@@ -88,46 +85,5 @@ func (ebc WinlogbeatConfig) Validate() error {
8885
"configured as part of event_logs"))
8986
}
9087

91-
if err := ebc.Metrics.Validate(); err != nil {
92-
errs = append(errs, err)
93-
}
94-
9588
return errs.Err()
9689
}
97-
98-
// MetricsConfig holds the configuration data for the HTTP metric service.
99-
type MetricsConfig struct {
100-
BindAddress string // Bind address for the metric service. Format is host:port.
101-
}
102-
103-
// Validate validates the MetricsConfig data and returns an error describing any
104-
// problems or nil.
105-
func (mc MetricsConfig) Validate() error {
106-
if mc.BindAddress == "" {
107-
return nil
108-
}
109-
110-
host, portStr, err := net.SplitHostPort(mc.BindAddress)
111-
if err != nil {
112-
return fmt.Errorf("bind_address must be formatted as host:port but "+
113-
"was '%s' (%v)", mc.BindAddress, err)
114-
}
115-
116-
if len(host) == 0 {
117-
return fmt.Errorf("bind_address value ('%s') is missing a host",
118-
mc.BindAddress)
119-
}
120-
121-
port, err := strconv.Atoi(portStr)
122-
if err != nil {
123-
return fmt.Errorf("bind_address port value ('%s') must be a number "+
124-
"(%v)", portStr, err)
125-
}
126-
127-
if port < 1 || port > 65535 {
128-
return fmt.Errorf("bind_address port must be within [1-65535] but "+
129-
"was '%d'", port)
130-
}
131-
132-
return nil
133-
}

winlogbeat/config/config_test.go

-40
Original file line numberDiff line numberDiff line change
@@ -55,46 +55,6 @@ func TestConfigValidate(t *testing.T) {
5555
"1 error: At least one event log must be configured as part of " +
5656
"event_logs",
5757
},
58-
{
59-
WinlogbeatConfig{
60-
EventLogs: []map[string]interface{}{
61-
{"Name": "App"},
62-
},
63-
Metrics: MetricsConfig{BindAddress: "example.com"},
64-
},
65-
"1 error: bind_address",
66-
},
67-
// MetricsConfig
68-
{
69-
MetricsConfig{},
70-
"",
71-
},
72-
{
73-
MetricsConfig{BindAddress: "example.com:6700"},
74-
"",
75-
},
76-
{
77-
MetricsConfig{BindAddress: "example.com"},
78-
"bind_address must be formatted as host:port but was " +
79-
"'example.com' (missing port in address example.com)",
80-
},
81-
{
82-
MetricsConfig{BindAddress: ":1"},
83-
"bind_address value (':1') is missing a host",
84-
},
85-
{
86-
MetricsConfig{BindAddress: "example.com:1024f"},
87-
"bind_address port value ('1024f') must be a number " +
88-
"(strconv.ParseInt: parsing \"1024f\": invalid syntax)",
89-
},
90-
{
91-
MetricsConfig{BindAddress: "example.com:0"},
92-
"bind_address port must be within [1-65535] but was '0'",
93-
},
94-
{
95-
MetricsConfig{BindAddress: "example.com:65536"},
96-
"bind_address port must be within [1-65535] but was '65536'",
97-
},
9858
}
9959

10060
for _, test := range testCases {

winlogbeat/docs/reference/configuration/winlogbeat-options.asciidoc

+7-30
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Windows will prevent Winlogbeat from reading the event log because it limits the
170170
number of conditions that can be used in an event log query. If this occurs a similar
171171
warning as shown below will be logged by Winlogbeat, and it will continue
172172
processing data from other event logs. For more information, see
173-
https://support.microsoft.com/en-us/kb/970453.
173+
https://support.microsoft.com/en-us/kb/970453.
174174
175175
`WARN EventLog[Application] Open() error. No events will be read from this
176176
source. The specified query is invalid.`
@@ -183,12 +183,12 @@ event IDs.
183183
184184
[source,yaml]
185185
--------------------------------------------------------------------------------
186-
processors:
187-
- drop_event.when.and:
188-
- equals.log_name: Security
189-
- not.or:
190-
- equals.event_id: 903
191-
- equals.event_id: 1024
186+
processors:
187+
- drop_event.when.and:
188+
- equals.log_name: Security
189+
- not.or:
190+
- equals.event_id: 903
191+
- equals.event_id: 1024
192192
- equals.event_id: 4624
193193
--------------------------------------------------------------------------------
194194
@@ -326,29 +326,6 @@ under a `fields` sub-dictionary. If the custom field names conflict with other
326326
field names added by Winlogbeat, then the custom fields overwrite the other
327327
fields.
328328

329-
===== metrics.bindaddress
330-
331-
The hostname and port where the Beat will host an HTTP web service that provides
332-
metrics. This field is optional.
333-
334-
The following example specifies that the metrics service is available at
335-
http://localhost:8128/debug/vars:
336-
337-
[source,yaml]
338-
--------------------------------------------------------------------------------
339-
winlogbeat.metrics:
340-
bindaddress: 'localhost:8123'
341-
--------------------------------------------------------------------------------
342-
343-
The metrics are served as a JSON document. The metrics include:
344-
345-
- memory stats
346-
- number of published events from each log
347-
- total number of failures while publishing
348-
- total number of filtered events
349-
- total number of successfully published events
350-
- uptime
351-
352329
include::../../../../libbeat/docs/generalconfig.asciidoc[]
353330

354331
include::../../../../libbeat/docs/outputconfig.asciidoc[]

winlogbeat/winlogbeat.full.yml

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@
1414
# in the directory in which it was started.
1515
#winlogbeat.registry_file: .winlogbeat.yml
1616

17-
# Diagnostic metrics that can retrieved through a web interface if a
18-
# bindaddress value (host:port) is specified. The web address will be
19-
# http://<bindaddress>/debug/vars
20-
#winlogbeat.metrics:
21-
# bindaddress: 'localhost:8123'
22-
2317
# event_logs specifies a list of event logs to monitor as well as any
2418
# accompanying options. The YAML data type of event_logs is a list of
2519
# dictionaries.

0 commit comments

Comments
 (0)