Skip to content
Notifications
Clear all

Help: Audit logs missing events for a policy we know was triggered.

3 Posts
3 Users
0 Reactions
1 Views
(@backend_latency_queen)
Reputable Member
Joined: 2 months ago
Posts: 215
Topic starter   [#22461]

We've implemented Cloudflare Access to protect several internal admin panels. Our policies are working, and users are being correctly allowed or denied. However, our security team flagged a discrepancy during their weekly audit: we cannot find log entries in the Access audit logs for specific policy evaluations that we *know* occurred, based on our own application logs.

Our setup:
* A Gateway policy that routes `admin.internal.example.com` to an internal service.
* An Access Application policy attached to that hostname, requiring a valid email from our domain.
* We have the **Audit Log** subscription enabled.

The workflow that's causing confusion:
1. User attempts to access `admin.internal.example.com`.
2. They are correctly challenged by Cloudflare Access.
3. Upon successful auth, they proceed to the application. Our app logs the authenticated user's email and timestamp.
4. When we query the Access Audit Logs via the dashboard or the API for that timeframe and user email, the event for that specific policy evaluation is absent. We see other events for the user, but not the crucial "policy evaluated/approved" one.

We've used this API endpoint: `/accounts/{account_id}/access/logs/access_requests`. The returned JSON doesn't contain the missing events.

Key questions:
* Is there a known latency or processing delay before certain audit events appear, perhaps longer than others?
* Could this be related to the specific policy type or the order of evaluation (e.g., Gateway vs. Access policies)?
* Are we querying the correct log stream? Should we be looking at Zero Trust logs versus the older dashboard's logs?

A code snippet of our basic audit log fetch:

```go
func fetchAccessLogs(accountID, authToken string, startTime time.Time) ([]AccessRequestLog, error) {
url := fmt.Sprintf("https://api.cloudflare.com/client/v4/accounts/%s/access/logs/access_requests", accountID)
// ... set headers, add query params for start/end time ...
// HTTP client execution and JSON unmarshalling
}
```

Any insight into the log pipeline or common configuration oversights would be appreciated. We need a complete audit trail.

-- latency


sub-100ms or bust


   
Quote
(@cloud_ops_learner_99)
Reputable Member
Joined: 2 months ago
Posts: 171
 

Oh yeah, that's spooky. I'm just starting with Cloudflare Access myself, and I'd be sweating if our audit logs didn't match up.

I saw something similar, but for me it turned out the logs were in a different dataset? Like the Gateway Network logs vs the Access logs. I was using the wrong filter set in the dashboard for a bit. 😅

When you say you see other events for the user, are those from other applications or the same one? Could there be a delay you're hitting?



   
ReplyQuote
(@cloud_infra_rookie)
Honorable Member
Joined: 2 months ago
Posts: 285
 

Oh, the dataset mix-up is a great call. I'd have made that same mistake for sure.

But even within the Access logs, I wonder if there's a log level or verbosity setting somewhere? Like, maybe it only logs certain types of policy evaluations? I'm coming from AWS where you have to turn on specific log types. Could it be similar here?



   
ReplyQuote