# Cloudflare

## Requirements

* Account ID
* Account API Token

## Navigation Steps


1. Login to your Cloudflare account. 
2. Follow Cloudflare instructions to create an Account API Token:  
   <https://developers.cloudflare.com/fundamentals/api/get-started/account-owned-tokens/>
3. Ensure the token has permission to read all resources. At the time of writing, Cloudflare provides a template for this:

 ![](https://outline.cybersift.io/api/files.get?sig=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXkiOiJ1cGxvYWRzL2MwNWNhZDYzLTA0ZmEtNGFmZC04NjMwLTI3MjNjZDYwZWZkNS8zYWNmYmU2Zi0yODM4LTQ5NWYtYjQ4MS0zNmQzNWJmZmY0NDEvaW1hZ2UucG5nIiwidHlwZSI6ImF0dGFjaG1lbnQiLCJpYXQiOjE3OTUxNDcyMDAsImV4cCI6MTc5NTIzMzYwMH0.vuU8ur4Aj5r1y7csGfFEdyN6i21XUwVu65Vzru_cOHU " =770x365")


4. Take note of the `Account ID` the `API token` is created. 
5. **Testing** that you have the right permissions/token/account can be done by running the following curl command in a terminal: 

   
   1. ```powershell
      curl -X GET "https://api.cloudflare.com/client/v4/accounts/YOUR_ACCOUNT_ID/logs/audit?since=2025-03-01T00:00:00Z&before=2040-09-29T23:59:59Z" \ 
          -H "Accept: application/json" \
          -H "Authorization: Bearer YOUR_API_TOKEN"
      ```



---


:::success
Available on [Data Gallery](/doc/6ecc8c58-3d81-4f32-80e0-984c8092653e)   
No NiFi configuration required! 

:::

# NiFi Provisioning 

| Processor | Version |
|-----------|---------|
| `CloudflareAudit` | 1.0 > 1.x |

## Pipeline Structure

```mermaidjs
graph TD
    CloudflareAudit -- "EVENTS" --> PutElasticCS
    CloudflareAudit -- "FILTERED" --> PutElasticCS
    CloudflareAudit -- "ALERTS" --> PutElasticCS-Alerts
```

### Configuring `CloudflareAudit` processor 

*Processor Version 1.0*

| Property | Value |
|----------|-------|
| **Api Token** | `Your API Token` |
| **Account ID**  | `Your Account ID` |

### Configuring `PutElasticCS`

*Processor Version 1.0* 

| Property | Value | Value |
|----------|-------|-------|
| **Elasticsearch ID attribute** | `es_id` | `es_id` |
| **Elasticsearch Default Index** | `cloudflare-${now():format('yyyy.MM.dd')}` | `alerts-${now():format('yyyy.MM.dd')}` |
| **Elasticsearch Username** | No value set | No value set |
| **Elasticsearch Index Flowfile Attribute** | No value set | No value set |
| **Proxy Port** | No value set | No value set |
| **Backup Directory** | No value set | No value set |
| **Proxy IP** | No value set | No value set |
| **Bulk Size** | 1000  | 1000  |
| **Elasticsearch Password** | No value set | No value set |
| **Multiple JSON per flowfile** | FALSE | FALSE |
| **Elasticsearch URL** | [__http://localhost:9200__](http://localhost:9200) | [__http://localhost:9200__](http://localhost:9200) |



:::success
You successfully configured the log source, please make sure to define the [Index Patterns](/doc/c6b29c57-cd4c-4c74-b241-73f0aebc0203)

:::


---


:::info
tags:

* Cloudflare Logs Setup
* NiFi Cloudflare Setup

:::

---

**Documents**

- [Logs and Architecture](https://outline.cybersift.io/s/sentio-siem/doc/logs-and-architecture-acvUiDgvI5)
- [Sentio](https://outline.cybersift.io/s/sentio-siem/doc/sentio-KuYAbF5grr)
- [ISO27001:2022](https://outline.cybersift.io/s/sentio-siem/doc/iso270012022-7S5IzvF6a0)
- [FAQ](https://outline.cybersift.io/s/sentio-siem/doc/faq-vVyRNyNb60)