Skip to content

Commit

Permalink
[Autodiscover] Handle input-not-finished errors in config reload (#20915
Browse files Browse the repository at this point in the history
)
  • Loading branch information
ChrsMark authored Sep 2, 2020
1 parent a2c7258 commit 35e6b60
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- [Metricbeat][Kubernetes] Change cluster_ip field from ip to keyword. {pull}20571[20571]
- Rename cloud.provider `az` value to `azure` inside the add_cloud_metadata processor. {pull}20689[20689]
- Add missing country_name geo field in `add_host_metadata` and `add_observer_metadata` processors. {issue}20796[20796] {pull}20811[20811]
- [Autodiscover] Handle input-not-finished errors in config reload. {pull}20915[20915]
- Explicitly detect missing variables in autodiscover configuration, log them at the debug level. {issue}20568[20568] {pull}20898[20898]

*Auditbeat*
Expand Down
2 changes: 1 addition & 1 deletion filebeat/input/log/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (p *Input) loadStates(states []file.State) error {

// In case a input is tried to be started with an unfinished state matching the glob pattern
if !state.Finished {
return &input.ErrInputNotFinished{State: state.String()}
return &common.ErrInputNotFinished{State: state.String()}
}

// Convert state to current identifier if different
Expand Down
2 changes: 1 addition & 1 deletion filebeat/input/runnerfactory.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (r *RunnerFactory) Create(

func (r *RunnerFactory) CheckConfig(cfg *common.Config) error {
_, err := r.Create(pipeline.NewNilPipeline(), cfg)
if _, ok := err.(*ErrInputNotFinished); ok {
if _, ok := err.(*common.ErrInputNotFinished); ok {
// error is related to state, and hence config can be considered valid
return nil
}
Expand Down
7 changes: 6 additions & 1 deletion libbeat/cfgfile/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ func (r *RunnerList) Reload(configs []*reload.ConfigWithMeta) error {
for hash, config := range startList {
runner, err := createRunner(r.factory, r.pipeline, config)
if err != nil {
r.logger.Errorf("Error creating runner from config: %s", err)
if _, ok := err.(*common.ErrInputNotFinished); ok {
// error is related to state, we should not log at error level
r.logger.Debugf("Error creating runner from config: %s", err)
} else {
r.logger.Errorf("Error creating runner from config: %s", err)
}
errs = append(errs, errors.Wrap(err, "Error creating runner from config"))
continue
}
Expand Down
2 changes: 1 addition & 1 deletion filebeat/input/errors.go → libbeat/common/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package input
package common

import (
"fmt"
Expand Down

0 comments on commit 35e6b60

Please sign in to comment.