@@ -188,6 +188,14 @@ func (s *SumoLogicAppender) AppendLogs(buffer *SumoBuffer) {
188188 buffer .logEventsInCurrentBuffer ++
189189
190190}
191+ func ParseCustomMetadata (customMetadata string ) map [string ]string {
192+ cMetadataArray := strings .Split (customMetadata , "," )
193+ customMetadataMap := make (map [string ]string )
194+ for i := 0 ; i < len (cMetadataArray ); i ++ {
195+ customMetadataMap [strings .Split (cMetadataArray [i ], ":" )[0 ]] = strings .Split (cMetadataArray [i ], ":" )[1 ]
196+ }
197+ return customMetadataMap
198+ }
191199
192200func (s * SumoLogicAppender ) SendToSumo (logStringToSend string ) {
193201 if logStringToSend != "" {
@@ -213,9 +221,9 @@ func (s *SumoLogicAppender) SendToSumo(logStringToSend string) {
213221 }
214222
215223 if s .customMetadata != "" {
216- cMetadataArray := strings . Split (s .customMetadata , "," )
217- for i := 0 ; i < len ( cMetadataArray ); i ++ {
218- request .Header .Add (strings . Split ( cMetadataArray [ i ], ":" )[ 0 ], strings . Split ( cMetadataArray [ i ], ":" )[ 1 ] )
224+ customMetadataMap := ParseCustomMetadata (s .customMetadata )
225+ for key , value := range customMetadataMap {
226+ request .Header .Add (key , value )
219227 }
220228 }
221229 //checking the timer before first POST intent
0 commit comments