func KustoMetadata()

in pkg/otlp/logs.go [22:53]


func KustoMetadata(l *logsv1.LogRecord) (database, table string) {
	if l == nil {
		return
	}
	for _, a := range l.GetAttributes() {
		switch a.GetKey() {
		case dbKey:
			database = a.GetValue().GetStringValue()
		case tblKey:
			table = a.GetValue().GetStringValue()
		}
		if database != "" && table != "" {
			return
		}
	}
	if b := l.GetBody(); b != nil {
		if lv := b.GetKvlistValue(); lv != nil {
			for _, v := range lv.GetValues() {
				switch v.GetKey() {
				case dbKey:
					database = v.GetValue().GetStringValue()
				case tblKey:
					table = v.GetValue().GetStringValue()
				}
				if database != "" && table != "" {
					return
				}
			}
		}
	}
	return
}