bulldog/cf-firewall-events

Retrieve logs of the mitigations performed by the Cloudflare Firewall.

v1.1.0 2019-01-21 02:03 UTC

This package is auto-updated.

Last update: 2024-12-21 21:08:52 UTC


README

Retrieve the logs from the Cloudflare Firewall.

Usage

Basic usage example with no parameters.

<?php
require 'vendor/autoload.php';

$guzzle = new \GuzzleHttp\Client([
    'base_uri' => 'https://api.cloudflare.com/client/v4/',
    'headers' => [
        'X-Auth-Key' => '',
        'X-Auth-Email' => ''
    ]
]);

$fw = new \Bulldog\Cloudflare\Firewall($guzzle);
$events = $fw->events('zoneid');

$logs = $events->getBody()->getContents();

Limit the number of results to 10.

<?php
require 'vendor/autoload.php';

$guzzle = new \GuzzleHttp\Client([
    'base_uri' => 'https://api.cloudflare.com/client/v4/',
    'headers' => [
        'X-Auth-Key' => '',
        'X-Auth-Email' => ''
    ]
]);

$fw = new \Bulldog\Cloudflare\Firewall($guzzle);
$events = $fw->events('zoneid', [
    'limit' => 10,
]);

$logs = $events->getBody()->getContents();

Additional options can be found in the Cloudflare API Docs.