Skip to content
Start here

Update Zero Trust account logging settings

client.zeroTrust.gateway.logging.update(LoggingUpdateParams { account_id, redact_pii, settings_by_rule_type } params, RequestOptionsoptions?): LoggingSetting { redact_pii, settings_by_rule_type }
PUT/accounts/{account_id}/gateway/logging

Update logging settings for the current Zero Trust account.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
params: LoggingUpdateParams { account_id, redact_pii, settings_by_rule_type }
account_id: string

Path param

redact_pii?: boolean

Body param: Indicate whether to redact personally identifiable information from activity logging (PII fields include source IP, user email, user ID, device ID, URL, referrer, and user agent).

settings_by_rule_type?: SettingsByRuleType

Body param: Configure logging settings for each rule type.

dns?: DNS { log_all, log_blocks }

Configure logging settings for DNS firewall.

log_all?: boolean

Specify whether to log all requests to this service.

log_blocks?: boolean

Specify whether to log only blocking requests to this service.

http?: HTTP { log_all, log_blocks }

Configure logging settings for HTTP/HTTPS firewall.

log_all?: boolean

Specify whether to log all requests to this service.

log_blocks?: boolean

Specify whether to log only blocking requests to this service.

l4?: L4 { log_all, log_blocks }

Configure logging settings for Network firewall.

log_all?: boolean

Specify whether to log all requests to this service.

log_blocks?: boolean

Specify whether to log only blocking requests to this service.

ReturnsExpand Collapse
LoggingSetting { redact_pii, settings_by_rule_type }
redact_pii?: boolean

Indicate whether to redact personally identifiable information from activity logging (PII fields include source IP, user email, user ID, device ID, URL, referrer, and user agent).

settings_by_rule_type?: SettingsByRuleType { dns, http, l4 }

Configure logging settings for each rule type.

dns?: DNS { log_all, log_blocks }

Configure logging settings for DNS firewall.

log_all?: boolean

Specify whether to log all requests to this service.

log_blocks?: boolean

Specify whether to log only blocking requests to this service.

http?: HTTP { log_all, log_blocks }

Configure logging settings for HTTP/HTTPS firewall.

log_all?: boolean

Specify whether to log all requests to this service.

log_blocks?: boolean

Specify whether to log only blocking requests to this service.

l4?: L4 { log_all, log_blocks }

Configure logging settings for Network firewall.

log_all?: boolean

Specify whether to log all requests to this service.

log_blocks?: boolean

Specify whether to log only blocking requests to this service.

Update Zero Trust account logging settings

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted
});

const loggingSetting = await client.zeroTrust.gateway.logging.update({
  account_id: '699d98642c564d2e855e9661899b7252',
});

console.log(loggingSetting.redact_pii);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "redact_pii": true,
    "settings_by_rule_type": {
      "dns": {
        "log_all": false,
        "log_blocks": true
      },
      "http": {
        "log_all": false,
        "log_blocks": true
      },
      "l4": {
        "log_all": false,
        "log_blocks": true
      }
    }
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "redact_pii": true,
    "settings_by_rule_type": {
      "dns": {
        "log_all": false,
        "log_blocks": true
      },
      "http": {
        "log_all": false,
        "log_blocks": true
      },
      "l4": {
        "log_all": false,
        "log_blocks": true
      }
    }
  }
}