-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.6](backport #34391) Only log publish event messages in trace log l…
…evel under elastic-agent (#34434) * Only log publish event messages in trace log level under elastic-agent (#34391) * Only log publish event messages in trace log level under elastic-agent. * Add changelog entry. * Fix changelog. * Add same logic to processors. (cherry picked from commit 15ff7d1) # Conflicts: # libbeat/processors/actions/append.go * Remove append processor. --------- Co-authored-by: Blake Rouse <blake.rouse@elastic.co>
- Loading branch information
1 parent
66abded
commit 379f4d5
Showing
12 changed files
with
120 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Licensed to Elasticsearch B.V. under one or more contributor | ||
// license agreements. See the NOTICE file distributed with | ||
// this work for additional information regarding copyright | ||
// ownership. Elasticsearch B.V. licenses this file to you under | ||
// the Apache License, Version 2.0 (the "License"); you may | ||
// not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
package publisher | ||
|
||
import ( | ||
"github.com/elastic/beats/v7/libbeat/common/atomic" | ||
) | ||
|
||
var ( | ||
// underAgent is set to true with this beat is being ran under the elastic-agent | ||
underAgent = atomic.MakeBool(false) | ||
|
||
// underAgentTrace is set to true when the elastic-agent has placed this beat into | ||
// trace mode (which enables logging of published events) | ||
underAgentTrace = atomic.MakeBool(false) | ||
) | ||
|
||
// SetUnderAgent sets that the processing pipeline is being ran under the elastic-agent. | ||
func SetUnderAgent(val bool) { | ||
underAgent.Store(val) | ||
} | ||
|
||
// SetUnderAgentTrace sets that trace mode has been enabled by the elastic-agent. | ||
// | ||
// SetUnderAgent must also be called and set to true before this has an effect. | ||
func SetUnderAgentTrace(val bool) { | ||
underAgentTrace.Store(val) | ||
} | ||
|
||
// UnderAgent returns true when running under Elastic Agent. | ||
func UnderAgent() bool { | ||
return underAgent.Load() | ||
} | ||
|
||
// LogWithTrace returns true when not running under Elastic Agent always or | ||
// only true if running under Elastic Agent with trace logging enabled. | ||
func LogWithTrace() bool { | ||
agent := underAgent.Load() | ||
if agent { | ||
trace := underAgentTrace.Load() | ||
return trace | ||
} | ||
// Always true when not running under the Elastic Agent. | ||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters