From a57f3fc30dc1f8c933f39d2c37792fa03d8c3ab9 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Thu, 2 Dec 2021 22:30:45 +0700 Subject: all: add patch to minimize unnecessary logs Currently, running default otelopscol (opentelemetry-operations-collector) will thrown the errors as described in [1]. This patch fix it by removing scraper "process" and "processes" from hostmetrics and by changing default log level from "info" to "error". [1] https://cloud.google.com/logging/docs/agent/ops-agent/troubleshooting#log-spam --- .SRCINFO | 4 +++- 0001-apps-hostmetrics.patch | 35 +++++++++++++++++++++++++++++++++++ PKGBUILD | 5 ++++- 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 0001-apps-hostmetrics.patch diff --git a/.SRCINFO b/.SRCINFO index 5a3f506..804c5dd 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = google-cloud-ops-agent-git pkgdesc = Ops Agents that are part of the Google Cloud Operations product suite (specifically Cloud Logging and Cloud Monitoring) pkgver = 2.7.0.r7.g43187fc - pkgrel = 1 + pkgrel = 2 url = https://github.com/GoogleCloudPlatform/ops-agent arch = x86_64 license = Apache License 2.0 @@ -16,10 +16,12 @@ pkgbase = google-cloud-ops-agent-git source = fluent-bit::git+https://github.com/fluent/fluent-bit.git source = opentelemetry-operations-collector::git+https://github.com/GoogleCloudPlatform/opentelemetry-operations-collector.git source = opentelemetry-java-contrib::git+https://github.com/open-telemetry/opentelemetry-java-contrib.git + source = 0001-apps-hostmetrics.patch md5sums = SKIP md5sums = SKIP md5sums = SKIP md5sums = SKIP md5sums = SKIP + md5sums = a5cbb09890214d1c14a2cf33267808c5 pkgname = google-cloud-ops-agent-git diff --git a/0001-apps-hostmetrics.patch b/0001-apps-hostmetrics.patch new file mode 100644 index 0000000..8a5a8a8 --- /dev/null +++ b/0001-apps-hostmetrics.patch @@ -0,0 +1,35 @@ +diff --git a/apps/hostmetrics.go b/apps/hostmetrics.go +index 84bdc49..14a77f7 100644 +--- a/apps/hostmetrics.go ++++ b/apps/hostmetrics.go +@@ -43,8 +43,6 @@ func (r MetricsReceiverHostmetrics) Pipelines() []otel.Pipeline { + "filesystem": struct{}{}, + "network": struct{}{}, + "paging": struct{}{}, +- "process": struct{}{}, +- "processes": struct{}{}, + }, + }, + }, +diff --git a/confgenerator/confgenerator.go b/confgenerator/confgenerator.go +index 1916bcd..a8443ec 100644 +--- a/confgenerator/confgenerator.go ++++ b/confgenerator/confgenerator.go +@@ -47,7 +47,7 @@ func (uc *UnifiedConfig) GenerateOtelConfig(hostInfo *host.InfoStat) (string, er + }.Pipeline() + + if uc.Metrics.Service.LogLevel == "" { +- uc.Metrics.Service.LogLevel = "info" ++ uc.Metrics.Service.LogLevel = "error" + } + otelConfig, err := otel.ModularConfig{ + LogLevel: uc.Metrics.Service.LogLevel, +@@ -126,7 +126,7 @@ func (uc *UnifiedConfig) GenerateFluentBitConfigs(logsDir string, stateDir strin + func (l *Logging) generateFluentbitComponents(userAgent string, hostInfo *host.InfoStat) ([]fluentbit.Component, error) { + var out []fluentbit.Component + if l.Service.LogLevel == "" { +- l.Service.LogLevel = "info" ++ l.Service.LogLevel = "error" + } + out = append(out, fluentbit.Service{LogLevel: l.Service.LogLevel}.Component()) + diff --git a/PKGBUILD b/PKGBUILD index 70a9d48..0b8f9db 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=google-cloud-ops-agent-git pkgver=2.7.0.r7.g43187fc -pkgrel=1 +pkgrel=2 pkgdesc="Ops Agents that are part of the Google Cloud Operations product suite (specifically Cloud Logging and Cloud Monitoring)" arch=(x86_64) @@ -30,6 +30,7 @@ source=( "fluent-bit::git+https://github.com/fluent/fluent-bit.git" "opentelemetry-operations-collector::git+https://github.com/GoogleCloudPlatform/opentelemetry-operations-collector.git" "opentelemetry-java-contrib::git+https://github.com/open-telemetry/opentelemetry-java-contrib.git" + "0001-apps-hostmetrics.patch" ) md5sums=( 'SKIP' @@ -37,6 +38,7 @@ md5sums=( 'SKIP' 'SKIP' 'SKIP' + 'aa21cd77ff9aba8ba7b8583c97e71c8f' ) pkgver() { @@ -56,6 +58,7 @@ prepare() { git config submodule."submodules/opentelemetry-java-contrib".url \ "${srcdir}/opentelemetry-java-contrib" git submodule update + git apply "${srcdir}/0001-apps-hostmetrics.patch" } build() { -- cgit v1.3