Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions source/code/go/src/plugins/oms.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func updateContainerImageNameMaps() {
pods, err := ClientSet.CoreV1().Pods("").List(metav1.ListOptions{})
if err != nil {
Log("Error getting pods %s\nIt is ok to log here and continue, because the logs will be missing image and Name, but the logs will still have the containerID", err.Error())
continue
}

for _, pod := range pods.Items {
Expand Down Expand Up @@ -216,20 +217,12 @@ func PostDataHelper(tailPluginRecords []map[interface{}]interface{}) int {
stringMap["Image"] = val
} else {
Log("ContainerId %s not present in Map ", containerID)
Log("CurrentMap Snapshot \n")
for k, v := range ImageIDMap {
Log("%s ==> %s", k, v)
}
}

if val, ok := NameIDMap[containerID]; ok {
stringMap["Name"] = val
} else {
Log("ContainerId %s not present in Map ", containerID)
Log("CurrentMap Snapshot \n")
for k, v := range NameIDMap {
Log("%s ==> %s", k, v)
}
}

dataItem := DataItem{
Expand All @@ -253,6 +246,10 @@ func PostDataHelper(tailPluginRecords []map[interface{}]interface{}) int {
DataItems: dataItems}

marshalled, err := json.Marshal(logEntry)
if err != nil {
Log("Error while Marshalling log Entry: %s", err.Error())
return output.FLB_OK
}
req, _ := http.NewRequest("POST", OMSEndpoint, bytes.NewBuffer(marshalled))
req.Header.Set("Content-Type", "application/json")

Expand Down