Remove extra empty lines from log

remove extra "\n" from Everything()
This commit is contained in:
Cao Shufeng 2017-06-04 16:15:28 +08:00
parent 67730881a6
commit 3816b6fde5
3 changed files with 3 additions and 3 deletions

View File

@ -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)
}

View File

@ -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)))

View File

@ -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)
}
}