Skip to content

Commit

Permalink
Disable Azure syslog exception logging (#3341)
Browse files Browse the repository at this point in the history
As a follow-up to #3331, this disables Azure exception logging to
syslog.

Signed-off-by: Pedro Araujo <phcrva@gmail.com>
  • Loading branch information
pharaujo authored Oct 20, 2020
1 parent 053730c commit b5431c4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
### Fixed
- [#3257](https://github.com/thanos-io/thanos/pull/3257) Ruler: Prevent Ruler from crashing when using default DNS to lookup hosts that results in "No such hosts" errors.
- [#3331](https://github.com/thanos-io/thanos/pull/3331) Disable Azure blob exception logging
- [#3341](https://github.com/thanos-io/thanos/pull/3341) Disable Azure blob syslog exception logging

## [v0.16.0](https://github.com/thanos-io/thanos/releases) - Release in progress

Expand Down
11 changes: 11 additions & 0 deletions pkg/objstore/azure/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ const DirDelim = "/"

var errorCodeRegex = regexp.MustCompile(`X-Ms-Error-Code:\D*\[(\w+)\]`)

func init() {
// Disable `ForceLog` in Azure storage module
// As the time of this patch, the logging function in the storage module isn't correctly
// detecting expected REST errors like 404 and so outputs them to syslog along with a stacktrace.
// https://github.com/Azure/azure-storage-blob-go/issues/214
//
// This needs to be done at startup because the underlying variable is not thread safe.
// https://github.com/Azure/azure-pipeline-go/blob/dc95902f1d32034f8f743ccc6c3f2eb36b84da27/pipeline/core.go#L276-L283
pipeline.SetForceLogEnabled(false)
}

func getContainerURL(ctx context.Context, conf Config) (blob.ContainerURL, error) {
c, err := blob.NewSharedKeyCredential(conf.StorageAccountName, conf.StorageAccountKey)
if err != nil {
Expand Down

0 comments on commit b5431c4

Please sign in to comment.