---
title: Get logging settings for the Zero Trust account
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/typescript)

[Zero Trust](https://developers.cloudflare.com/api/typescript/resources/zero_trust)

[Gateway](https://developers.cloudflare.com/api/typescript/resources/zero_trust/subresources/gateway)

[Logging](https://developers.cloudflare.com/api/typescript/resources/zero_trust/subresources/gateway/subresources/logging)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Get logging settings for the Zero Trust account

client.zeroTrust.gateway.logging.get(LoggingGetParams {account\_id } params, RequestOptionsoptions?): [LoggingSetting](<https://developers.cloudflare.com/api/typescript/resources/zero_trust#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)>) {redact\_pii, settings\_by\_rule\_type }

GET/accounts/{account\_id}/gateway/logging

Retrieve the current logging settings for the Zero Trust account.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



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

**Example:**<code>X-Auth-Email: user@example.com</code>

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

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### ParametersExpand Collapse

<details>

<summary>

params: LoggingGetParams {account\_id }

</summary>

account\_id: string

Specify the Cloudflare account identifier.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(method)%20get%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

</details>

[Link to this property](<#(resource)%20zero_trust.gateway.logging%20%3E%20(method)%20get%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

LoggingSetting {redact\_pii, settings\_by\_rule\_type }

</summary>

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).

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20redact_pii">Link to this property</a>

<details>

<summary>

settings\_by\_rule\_type?: SettingsByRuleType {dns, http, l4 }

Configure logging settings for each rule type.

</summary>

<details>

<summary>

dns?: DNS {log\_all, log\_blocks }

Configure logging settings for DNS firewall.

</summary>

log\_all?: boolean

Specify whether to log all requests to this service.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20dns%20%3E%20(property)%20log_all">Link to this property</a>

log\_blocks?: boolean

Specify whether to log only blocking requests to this service.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20dns%20%3E%20(property)%20log_blocks">Link to this property</a>

</details>

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20dns">Link to this property</a>

<details>

<summary>

http?: HTTP {log\_all, log\_blocks }

Configure logging settings for HTTP/HTTPS firewall.

</summary>

log\_all?: boolean

Specify whether to log all requests to this service.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20http%20%3E%20(property)%20log_all">Link to this property</a>

log\_blocks?: boolean

Specify whether to log only blocking requests to this service.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20http%20%3E%20(property)%20log_blocks">Link to this property</a>

</details>

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20http">Link to this property</a>

<details>

<summary>

l4?: L4 {log\_all, log\_blocks }

Configure logging settings for Network firewall.

</summary>

log\_all?: boolean

Specify whether to log all requests to this service.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20l4%20%3E%20(property)%20log_all">Link to this property</a>

log\_blocks?: boolean

Specify whether to log only blocking requests to this service.

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20l4%20%3E%20(property)%20log_blocks">Link to this property</a>

</details>

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type%20%3E%20(property)%20l4">Link to this property</a>

</details>

<a href="#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)%20%3E%20(property)%20settings_by_rule_type">Link to this property</a>

</details>

[Link to this property](<#(resource)%20zero_trust.gateway.logging%20%3E%20(model)%20logging_setting%20%3E%20(schema)>)

### Get logging settings for the Zero Trust account

TypeScript

HTTPTypeScriptPythonGoTerraform

```
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.get({
  account_id: '699d98642c564d2e855e9661899b7252',
});

console.log(loggingSetting.redact_pii);
```

200 example

```
{
  "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

200 example

```
{
  "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
      }
    }
  }
}
```