From 569a38cb03f61cbd7d3a1b2cdbfe36be87209335 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Wed, 12 Jul 2017 15:43:57 -0400 Subject: [PATCH] Add metrics counters for audit log failures Fixes #2863 --- vault/audit.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vault/audit.go b/vault/audit.go index 829ebba14cc1..fccf9aaa7a57 100644 --- a/vault/audit.go +++ b/vault/audit.go @@ -507,6 +507,10 @@ func (a *AuditBroker) LogRequest(auth *logical.Auth, req *logical.Request, heade } ret = retErr.ErrorOrNil() + + if ret != nil { + metrics.IncrCounter([]string{"audit", "log_request_failure"}, 1.0) + } }() // All logged requests must have an identifier @@ -565,6 +569,10 @@ func (a *AuditBroker) LogResponse(auth *logical.Auth, req *logical.Request, } ret = retErr.ErrorOrNil() + + if ret != nil { + metrics.IncrCounter([]string{"audit", "log_response_failure"}, 1.0) + } }() headers := req.Headers