Skip to content

Commit

Permalink
Remove metrics endpoint in winlogbeat
Browse files Browse the repository at this point in the history
The metrics endpoint is replaced by the http endpoint in libbeat. See elastic#3717
ruflin committed Apr 4, 2017
1 parent 4446527 commit 8fa61aa
Showing 7 changed files with 9 additions and 145 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]
- Remove deprecated geoip. {pull}3766[3766]

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


==== Bugfixes
6 changes: 0 additions & 6 deletions winlogbeat/_meta/beat.full.yml
Original file line number Diff line number Diff line change
@@ -14,12 +14,6 @@
# in the directory in which it was started.
#winlogbeat.registry_file: .winlogbeat.yml

# Diagnostic metrics that can retrieved through a web interface if a
# bindaddress value (host:port) is specified. The web address will be
# http://<bindaddress>/debug/vars
#winlogbeat.metrics:
# bindaddress: 'localhost:8123'

# event_logs specifies a list of event logs to monitor as well as any
# accompanying options. The YAML data type of event_logs is a list of
# dictionaries.
20 changes: 1 addition & 19 deletions winlogbeat/beater/winlogbeat.go
Original file line number Diff line number Diff line change
@@ -7,8 +7,6 @@ package beater
import (
"expvar"
"fmt"
"net"
"net/http"
"sync"
"time"

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

// Debug logging functions for this package.
var (
debugf = logp.MakeDebug("winlogbeat")
memstatsf = logp.MakeDebug("memstats")
debugf = logp.MakeDebug("winlogbeat")
)

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

if config.Metrics.BindAddress != "" {
bindAddress := config.Metrics.BindAddress
sock, err := net.Listen("tcp", bindAddress)
if err != nil {
return err
}
go func() {
logp.Info("Metrics hosted at http://%s/debug/vars", bindAddress)
err := http.Serve(sock, nil)
if err != nil {
logp.Warn("Unable to launch HTTP service for metrics. %v", err)
}
}()
}

return nil
}

44 changes: 0 additions & 44 deletions winlogbeat/config/config.go
Original file line number Diff line number Diff line change
@@ -3,9 +3,7 @@ package config

import (
"fmt"
"net"
"sort"
"strconv"
"strings"

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

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

if err := ebc.Metrics.Validate(); err != nil {
errs = append(errs, err)
}

return errs.Err()
}

// MetricsConfig holds the configuration data for the HTTP metric service.
type MetricsConfig struct {
BindAddress string // Bind address for the metric service. Format is host:port.
}

// Validate validates the MetricsConfig data and returns an error describing any
// problems or nil.
func (mc MetricsConfig) Validate() error {
if mc.BindAddress == "" {
return nil
}

host, portStr, err := net.SplitHostPort(mc.BindAddress)
if err != nil {
return fmt.Errorf("bind_address must be formatted as host:port but "+
"was '%s' (%v)", mc.BindAddress, err)
}

if len(host) == 0 {
return fmt.Errorf("bind_address value ('%s') is missing a host",
mc.BindAddress)
}

port, err := strconv.Atoi(portStr)
if err != nil {
return fmt.Errorf("bind_address port value ('%s') must be a number "+
"(%v)", portStr, err)
}

if port < 1 || port > 65535 {
return fmt.Errorf("bind_address port must be within [1-65535] but "+
"was '%d'", port)
}

return nil
}
40 changes: 0 additions & 40 deletions winlogbeat/config/config_test.go
Original file line number Diff line number Diff line change
@@ -55,46 +55,6 @@ func TestConfigValidate(t *testing.T) {
"1 error: At least one event log must be configured as part of " +
"event_logs",
},
{
WinlogbeatConfig{
EventLogs: []map[string]interface{}{
{"Name": "App"},
},
Metrics: MetricsConfig{BindAddress: "example.com"},
},
"1 error: bind_address",
},
// MetricsConfig
{
MetricsConfig{},
"",
},
{
MetricsConfig{BindAddress: "example.com:6700"},
"",
},
{
MetricsConfig{BindAddress: "example.com"},
"bind_address must be formatted as host:port but was " +
"'example.com' (missing port in address example.com)",
},
{
MetricsConfig{BindAddress: ":1"},
"bind_address value (':1') is missing a host",
},
{
MetricsConfig{BindAddress: "example.com:1024f"},
"bind_address port value ('1024f') must be a number " +
"(strconv.ParseInt: parsing \"1024f\": invalid syntax)",
},
{
MetricsConfig{BindAddress: "example.com:0"},
"bind_address port must be within [1-65535] but was '0'",
},
{
MetricsConfig{BindAddress: "example.com:65536"},
"bind_address port must be within [1-65535] but was '65536'",
},
}

for _, test := range testCases {
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ Windows will prevent Winlogbeat from reading the event log because it limits the
number of conditions that can be used in an event log query. If this occurs a similar
warning as shown below will be logged by Winlogbeat, and it will continue
processing data from other event logs. For more information, see
https://support.microsoft.com/en-us/kb/970453.
https://support.microsoft.com/en-us/kb/970453.
`WARN EventLog[Application] Open() error. No events will be read from this
source. The specified query is invalid.`
@@ -183,12 +183,12 @@ event IDs.
[source,yaml]
--------------------------------------------------------------------------------
processors:
- drop_event.when.and:
- equals.log_name: Security
- not.or:
- equals.event_id: 903
- equals.event_id: 1024
processors:
- drop_event.when.and:
- equals.log_name: Security
- not.or:
- equals.event_id: 903
- equals.event_id: 1024
- equals.event_id: 4624
--------------------------------------------------------------------------------
@@ -326,29 +326,6 @@ under a `fields` sub-dictionary. If the custom field names conflict with other
field names added by Winlogbeat, then the custom fields overwrite the other
fields.

===== metrics.bindaddress

The hostname and port where the Beat will host an HTTP web service that provides
metrics. This field is optional.

The following example specifies that the metrics service is available at
http://localhost:8128/debug/vars:

[source,yaml]
--------------------------------------------------------------------------------
winlogbeat.metrics:
bindaddress: 'localhost:8123'
--------------------------------------------------------------------------------

The metrics are served as a JSON document. The metrics include:

- memory stats
- number of published events from each log
- total number of failures while publishing
- total number of filtered events
- total number of successfully published events
- uptime

include::../../../../libbeat/docs/generalconfig.asciidoc[]

include::../../../../libbeat/docs/outputconfig.asciidoc[]
6 changes: 0 additions & 6 deletions winlogbeat/winlogbeat.full.yml
Original file line number Diff line number Diff line change
@@ -14,12 +14,6 @@
# in the directory in which it was started.
#winlogbeat.registry_file: .winlogbeat.yml

# Diagnostic metrics that can retrieved through a web interface if a
# bindaddress value (host:port) is specified. The web address will be
# http://<bindaddress>/debug/vars
#winlogbeat.metrics:
# bindaddress: 'localhost:8123'

# event_logs specifies a list of event logs to monitor as well as any
# accompanying options. The YAML data type of event_logs is a list of
# dictionaries.

0 comments on commit 8fa61aa

Please sign in to comment.