After changing the audit policies on the Gateway or when adding external audit sinks, the following warning can be found in the API Gateway SSG logs:
WARNING 37 com.l7tech.server.audit.AuditLookupPolicyEvaluator: Error creating audit records, some fields not present: The variable "recordQuery.queryresult.count" could not be found.
This applies to all API Gateway versions.
This 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 but may be caused by other situations such as version upgrades.
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 warning and audits should continue to be created again.