From 383e55f5e4cff1f9bac1aa5f5926034f69936cf6 Mon Sep 17 00:00:00 2001 From: armstrmi Date: Mon, 9 May 2022 16:43:13 -0400 Subject: [PATCH 1/3] added fix to include string array type to converter --- internal/stanza/converter.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/stanza/converter.go b/internal/stanza/converter.go index fb435a6bdc4a..886260de0364 100644 --- a/internal/stanza/converter.go +++ b/internal/stanza/converter.go @@ -370,6 +370,8 @@ func insertToAttributeVal(value interface{}, dest pcommon.Value) { dest.SetBoolVal(t) case string: dest.SetStringVal(t) + case []string: + toStringArray(t).CopyTo(dest) case []byte: dest.SetBytesVal(t) case int64: @@ -420,6 +422,9 @@ func insertToAttributeMap(obsMap map[string]interface{}, dest pcommon.Map) { dest.InsertBool(k, t) case string: dest.InsertString(k, t) + case []string: + arr := toStringArray(t) + dest.Insert(k, arr) case []byte: dest.InsertBytes(k, t) case int64: @@ -468,6 +473,16 @@ func toAttributeArray(obsArr []interface{}) pcommon.Value { return arrVal } +func toStringArray(strArr []string) pcommon.Value { + arrVal := pcommon.NewValueSlice() + arr := arrVal.SliceVal() + arr.EnsureCapacity(len(strArr)) + for _, v := range strArr { + insertToAttributeVal(v, arr.AppendEmpty()) + } + return arrVal +} + var sevMap = map[entry.Severity]plog.SeverityNumber{ entry.Default: plog.SeverityNumberUNDEFINED, entry.Trace: plog.SeverityNumberTRACE, From 79dbe50ff3e5e0725001505d761f1711d1ce2ed1 Mon Sep 17 00:00:00 2001 From: armstrmi Date: Mon, 9 May 2022 16:50:38 -0400 Subject: [PATCH 2/3] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c22171744231..9235ae32ddd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ - `tanzuobservabilityexporter`: Make metrics stanza in config be optional (#9098) - `filelogreceiver`: Update Kubernetes examples to fix native OTel logs collection issue where 0 length logs cause errors (#9754) - `logstransformprocessor`: Resolve node ordering to fix intermittent failures (#9761) +- `stanzaconverterfix`: Add string array as possible type for converting log record entries (#9887) ## v0.50.0 From 880c7a282dc13dedbfca7131e91469280e508f4a Mon Sep 17 00:00:00 2001 From: armstrmi Date: Tue, 10 May 2022 09:25:47 -0400 Subject: [PATCH 3/3] updated Changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9235ae32ddd8..7689f059a1bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,7 +51,7 @@ - `tanzuobservabilityexporter`: Make metrics stanza in config be optional (#9098) - `filelogreceiver`: Update Kubernetes examples to fix native OTel logs collection issue where 0 length logs cause errors (#9754) - `logstransformprocessor`: Resolve node ordering to fix intermittent failures (#9761) -- `stanzaconverterfix`: Add string array as possible type for converting log record entries (#9887) +- `filelog`, `journald`, `syslog`, `tcplog`, `udplog`: Add support for []string type for converting log record entries (#9887) ## v0.50.0