---
schema_version: "1"
id: 0f5e3002376a2cbad9aba27184af4539429a5fb32cbe11157b72f935fa5613a9
title: eCDN Logpush Filter
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/commerce-api/guides/cdn-zones-logpush-filter.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/cdn-zones-logpush-filter.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 32be5918247fba01917a96f611dfbf0ce0531443e0e029ba40b84a581db8952b
products:
  - Composable Storefront
  - Salesforce APIs
---
# eCDN Logpush Filter

## Create eCDN Logpush Job with Filter

Use the [B2C CLI](https://developer.salesforce.com/docs/commerce/b2c-commerce/guides/b2c-developer-tooling.md):

```bash
# Required scopes: sfcc.cdn-zones, sfcc.cdn-zones.rw
export SFCC_CLIENT_ID='your-account-manager-client-id'
export SFCC_CLIENT_SECRET='your-account-manager-client-secret'
export SFCC_SHORTCODE='your-short-code'

npx @salesforce/b2c-cli ecdn logpush jobs create \
  --tenant-id abcd_stg --zone stg-abcd-example-com.cc-ecdn.net \
  --name ExampleLogPushJob \
  --destination-path 's3://example-bucket/log?region=us-east-1' \
  --ownership-token 'your-ownership-challenge-token' \
  --log-type http_requests \
  --log-fields CacheCacheStatus,ClientRequestHost,ClientRequestPath,EdgeResponseStatus,EdgeStartTimestamp \
  --filter '{"where":{"key":"ClientRequestPath","operator":"contains","value":"/example-path"}}'
```

Alternatively, use the API:

```bash
curl "https://{shortCode}.api.commercecloud.salesforce.com/cdn/zones/v1/organizations/f_ecom_bcxj_prd/zones/{zoneId}/logpush/jobs" \
  --request POST \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "name": "ExampleLogPushJob",
  "destinationPath": "s3://example-bucket/log?region=us-east-1",
  "logType": "http_requests",
  "ownershipChallengeToken": "Put your ownership challenge token here",
  "filter": "{\"where\":{\"key\":\"ClientRequestPath\",\"operator\":\"contains\",\"value\":\"/example-path\"}}",
  "logFields": [
    "CacheCacheStatus",
    "CacheResponseBytes",
    "ClientRequestPath",
    "ClientRequestBytes",
    "ClientRequestHost",
    "ClientRequestUserAgent",
    "EdgeResponseStatus",
    "EdgeResponseBytes",
    "EdgeStartTimestamp",
    "EdgeTimeToFirstByteMs"
  ]
}'
```

## Successful Response

A successful response returns 201.

```json
{
  "data": {
    "jobId": 213543,
    "name": "ExampleLogPushJob",
    "logType": "http_requests",
    "logFields": [
      "CacheCacheStatus",
      "CacheResponseBytes",
      "ClientRequestPath",
      "ClientRequestBytes",
      "ClientRequestHost",
      "ClientRequestUserAgent",
      "EdgeResponseStatus",
      "EdgeResponseBytes",
      "EdgeStartTimestamp",
      "EdgeTimeToFirstByteMs"
    ],
    "filter": "{\"where\":{\"key\":\"ClientRequestPath\",\"operator\":\"contains\",\"value\":\"/example-path\"}}",
    "destinationPath": "s3://example-bucket/log?region=us-east-1",
    "enabled": false,
    "createdOn": "2023-04-18T17:18:43Z"
  }
}
```

## Filter Detail

The following table shows the supported comparison operators along with example values.

To add filters, provide the filter criteria in the form of escaped JSON strings with the format
`{\"where\":{\"key"\:\"<field>\",\"operator\":\"<comparison_operator>\",\"value\":\"<value>\"}}`.

**note:** - The `\“Key”\` field value must correspond to one of the available fields listed in [eCDN Logpush Log Field](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/cdn-zones-logpush-log-field.md).
- For the Firewall events dataset, filtering is not supported for the following fields: `Action`, `Description`, `Kind`, `MatchIndex`,`Metadata`, `OriginatorRayID`, `RuleID`, and `Source`.

| Name                            | Operator Notation | Supported Field Types | Example                                                                                        |
| ------------------------------- | ----------------- | --------------------- | ---------------------------------------------------------------------------------------------- |
| Equal                           | eq                | String, Int, Bool     | `{\“where\":{\"key\":\"ClientRequestHost\",\"operator\":\"eq\",\"value\":\"example.com\"}}`    |
| Not equal                       | !eq               | String, Int, Bool     | `{\“where\":{\"key\":\"ClientCountry\",\"operator\":\"!eq\",\"value\":\"ca\"}} `               |
| Less than                       | lt                | Int                   | `{\“where\":{\"key\":\"BotScore\",\"operator\":\"lt\",\"value\":\"30\"}}`                      |
| Less than or equal              | leq               | Int                   | `{\“where\":{\"key\":\"BotScore\",\"operator\":\"leq\",\"value\":\"30\"}}`                     |
| Greater than                    | gt                | Int                   | `{\“where\":{\"key\":\"BotScore\",\"operator\":\"gt\",\"value\":\"30\"}}`                      |
| Greater than or equal           | geq               | Int                   | `{\“where\":{\"key\":\"BotScore\",\"operator\":\"geq\",\"value\":\"30\"}}`                     |
| Starts with                     | startsWith        | String                | `{\“where\":{\"key\":\"ClientRequestPath\",\"operator\":\"startsWith\",\"value\":\"/foo\"}}`   |
| Ends with                       | endsWith          | String                | `{\“where\":{\"key\":\"ClientRequestPath\",\"operator\":\"endsWith\",\"value\":\"/foo\"}}`     |
| Does not start with             | !startsWith       | String                | `{\“where\":{\"key\":\"ClientRequestPath\",\"operator\":\"!startsWith\",\"value\":\"/foo\"}}`  |
| Does not end with               | !endsWith         | String                | `{\“where\":{\"key\":\"ClientRequestPath\",\"operator\":\"!endsWith\",\"value\":\"/foo\"}}`    |
| Contains                        | contains          | String, Bool          | `{\“where\":{\"key\":\"ClientRequestPath\",\"operator\":\"contains\",\"value\":\"/static\"}}`  |
| Does not contain                | !contains         | String, Bool          | `{\“where\":{\"key\":\"ClientRequestPath\",\"operator\":\"!contains\",\"value\":\"/static\"}}` |
| Value is in a set of values     | in                | String, Int, Array    | `{\“where\":{\"key\":\"EdgeResponseStatus\",\"operator\":\"in\",\"value\":[200,201]}}`         |
| Value is not in a set of values | !in               | String, Int, Array    | `{\“where\":{\"key\":\"EdgeResponseStatus\",\"operator\":\"!in\",\"value\":[200,201]}}`        |

## Logical Operators in Filter

- Filters can be connected using `AND, OR` logical operators.
- Logical operators can be nested.

Here are some examples of how the logical operators can be implemented. X, Y, and Z are used to represent filter criteria:

- X AND Y AND Z - `{"where":{"and":[{X},{Y},{Z}]}}`
- X OR Y OR Z - `{"where":{"or":[{X},{Y},{Z}]}}`
- X AND (Y OR Z) - `{"where":{"and":[{X}, {"or":[{Y},{Z}]}]}}`
- (X AND Y) OR Z - `{"where":{"or":[{"and": [{X},{Y}]},{Z}]}}`

## Example Request

In this example, the eCDN logpush job sends the logs to the S3 bucket only if the log has ClientRequestPath that contains `“/example-path”` and EdgeResponseStatus includes `502, 503, and 504.`

```bash
curl "https://{shortCode}.api.commercecloud.salesforce.com/cdn/zones/v1/organizations/f_ecom_bcxj_prd/zones/{zoneId}/logpush/jobs" \
  --request POST \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "name": "ExampleLogPushJob",
  "destinationPath": "s3://example-bucket/log?region=us-east-1",
  "logType": "http_requests",
  "ownershipChallengeToken": "Put your ownership challenge token here",
  "filter": "{\"where\":{\"and\":[{\"key\":\"ClientRequestPath\",\"operator\":\"contains\",\"value\":\"/example-path\"}, {\"key\":\"EdgeResponseStatus\",\"operator\":\"in\",\"value\":[502, 503, 504]}]}}",
  "logFields": [
    "CacheCacheStatus",
    "CacheResponseBytes",
    "ClientRequestPath",
    "ClientRequestBytes",
    "ClientRequestHost",
    "ClientRequestUserAgent",
    "EdgeResponseStatus",
    "EdgeResponseBytes",
    "EdgeStartTimestamp",
    "EdgeTimeToFirstByteMs"
  ]
}'
```
