Remove extra empty lines from log
remove extra "\n" from Everything()
This commit is contained in:
		| @@ -60,7 +60,7 @@ func EventString(ev *auditinternal.Event) string { | ||||
| 		ip = ev.SourceIPs[0] | ||||
| 	} | ||||
|  | ||||
| 	return fmt.Sprintf("%s AUDIT: id=%q stage=%q ip=%q method=%q user=%q groups=%q as=%q asgroups=%q namespace=%q uri=%q response=\"%s\"\n", | ||||
| 	return fmt.Sprintf("%s AUDIT: id=%q stage=%q ip=%q method=%q user=%q groups=%q as=%q asgroups=%q namespace=%q uri=%q response=\"%s\"", | ||||
| 		ev.Timestamp.Format(time.RFC3339Nano), ev.AuditID, ev.Stage, ip, ev.Verb, username, groups, asuser, asgroups, namespace, ev.RequestURI, response) | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -72,7 +72,7 @@ func ObservePolicyLevel(level auditinternal.Level) { | ||||
|  | ||||
| // HandlePluginError handles an error that occurred in an audit plugin. This method should only be | ||||
| // used if the error may have prevented the audit event from being properly recorded. The events are | ||||
| // modified. | ||||
| // logged to the debug log. | ||||
| func HandlePluginError(plugin string, err error, impacted ...*auditinternal.Event) { | ||||
| 	// Count the error. | ||||
| 	errorCounter.WithLabelValues(plugin).Add(float64(len(impacted))) | ||||
|   | ||||
| @@ -47,7 +47,7 @@ func (b *backend) ProcessEvents(events ...*auditinternal.Event) { | ||||
|  | ||||
| func (b *backend) logEvent(ev *auditinternal.Event) { | ||||
| 	line := audit.EventString(ev) | ||||
| 	if _, err := fmt.Fprint(b.out, line); err != nil { | ||||
| 	if _, err := fmt.Fprintln(b.out, line); err != nil { | ||||
| 		audit.HandlePluginError("log", err, ev) | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Cao Shufeng
					Cao Shufeng