add labels to lokiwritter after initialisation
This commit is contained in:
		@@ -55,6 +55,15 @@ func (w *LokiWriter) Write(p []byte) (n int, err error) {
 | 
			
		||||
	}
 | 
			
		||||
	labels["level"] = level
 | 
			
		||||
 | 
			
		||||
	// Add label that have been added to the event
 | 
			
		||||
 | 
			
		||||
	for k,v := range(event){
 | 
			
		||||
		if k != "level" && k != "time" && k != "message"{
 | 
			
		||||
			data := v.(map[string]string)
 | 
			
		||||
			labels[k] = data["data"]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Format the timestamp in nanoseconds
 | 
			
		||||
	timestamp := fmt.Sprintf("%d000000", time.Now().UnixNano()/int64(time.Millisecond))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user