WARNING 37 com.l7tech.server.audit.AuditLookupPolicyEvaluator may appear in the CA API Gateway log

Document ID : KB000072239
Last Modified Date : 27/02/2018
Show Technical Document Details
Issue:

After changing the audit policies on the gateway or when adding external audit sinks the following error can be found in the CA API Gateway logs:

2018-01-11T10:46:33.528+0000 INFO 37 com.l7tech.server.policy.assertion.ServerAuditDetailAssertion: -4: () : Internal Policy: [Internal Audit Lookup Policy] 
2018-01-11T10:46:33.528+0000 WARNING 37 com.l7tech.server.audit.AuditLookupPolicyEvaluator: Error creating audit records, some fields not present: The variable "recordQuery.queryresult.count" could not be found. 

Cause:
That message indicates the audit writer is trying to write audits to the database but can't find some fields. Typically this comes from changes in the audit policy on the Gateway in Policy Manager. 
Resolution:

Add a "Set Context Variable" assertion that sets "${recordQuery.queryresult.count} with a Data Type Integer value of 0 to the Internal Audit Lookup Policy.

This should prevent the error to occur.