---
title: "iOS SDK: Network logs"
description: "Capture network requests to investigate bug reports with the Gleap iOS SDK. Follow the integration code examples."
url: https://docs.gleap.ai/en/articles/455-ios-sdk-network-logs
collection: "iOS"
updated: 2026-11-01
language: en
---

# iOS SDK: Network logs

Capture network requests to investigate bug reports with the Gleap iOS SDK. Follow the integration code examples.

Gleap logs your app's network requests and attaches the most recent ones to every ticket, so you can see what went wrong.

## Setting up network logs

Network logs start automatically when you enable **Network logs** in the **Developer options** of your project in the [Gleap dashboard](https://app.gleap.ai). You can also start them from code:

**Swift**

```swift
Gleap.startNetworkRecording()
```

**Objective-C**

```objectivec
[Gleap startNetworkRecording];
```

Every request made with `URLSession` is logged, no matter which API or library sends it:

-   completion handler APIs (`dataTask(with:completionHandler:)`, `uploadTask(with:from:completionHandler:)`, ...),
    
-   Swift concurrency (`data(for:)`, `upload(for:from:)`, `bytes(for:)`),
    
-   delegate-based clients such as **Alamofire**, **Moya**, **Apollo** and **AFNetworking**.
    

No session configuration or plugin is needed.

### Stop network logs

To stop network logs from code, call `stopNetworkRecording()`. It overrides the dashboard setting (also when the configuration is loaded again) until you call `startNetworkRecording()`.

**Swift**

```swift
Gleap.stopNetworkRecording()
```

**Objective-C**

```objectivec
[Gleap stopNetworkRecording];
```

## What is logged

For each request Gleap logs the method, URL, request headers and body, response status, headers and body, the duration and, for failed or cancelled requests, the error. The last 30 requests are attached to a ticket; requests that are still running show up as pending.

-   Text bodies (JSON, XML, text, form data, GraphQL) are kept up to 150 KB, longer ones are truncated.
    
-   Binary bodies (images, files) and streaming responses (`text/event-stream`) are replaced by a marker, they are never buffered by the SDK.
    
-   Swift concurrency hands the response data to your code directly, so requests sent with `data(for:)` and similar are logged without the response body.
    

> **Note:** This applies to SDK **v19.0.0** and newer. Older versions only logged requests created with a completion handler and needed `Gleap.startNetworkRecording(for: configuration)` for Alamofire or AFNetworking; that method still works but is no longer needed. If you use the Gleap Moya plugin, you can remove it: requests are logged without it.

## Filtering network logs

Gleap allows you to strip off specific key/value pairs from network logs. This empowers you to easily remove sensitive data like `tokens`, `passwords` or `usernames`.

### How does it work?

Open Settings → Developer → Developer options → Network logs and add keys under Ignored keys. Use Excluded domains for hosts whose requests should not be recorded. These settings load with the widget configuration and are applied on the device before a report is sent.

-   **Headers**: request and response headers with a matching name are removed (the name is matched case-insensitively).
    
-   **JSON bodies**: matching keys are removed from request and response bodies at any depth, including objects inside arrays. A key with dots, like `user.password`, also removes exactly that path.
    
-   **Form bodies and URL parameters**: matching `application/x-www-form-urlencoded` fields and query parameters are removed.
    

Independent of this list, the values of the `Authorization`, `Proxy-Authorization`, `Cookie` and `Set-Cookie` headers are always replaced by `[REDACTED]`.

> **Note:** Matching nested keys, form fields and URL parameters, and the masked credential headers, need SDK **v19.0.0** or newer. Older SDKs only remove top-level keys from headers and JSON bodies, and the Android SDK applied neither the ignored keys nor the blacklist before v19.0.0.

#### Example

To remove an API key header and every `password` field, add `x-api-key` and `password` to the list.

### Set filter with code

It's also possible to set the network log filters by code. Each call replaces the previous list. The keys set in the dashboard apply in addition.

**Swift**

```swift
Gleap.setNetworkLogPropsToIgnore(["x-api-key", "password", "user.email"])
```

**Objective-C**

```objectivec
[Gleap setNetworkLogPropsToIgnore: @[@"x-api-key", @"password", @"user.email"]];
```

## Blacklisting URLs

It is possible to blacklist URLs or parts of URLs. If a network request matches one of the entries in the blacklist, the network request won't be included in the network logs.

> **Info:** Requests to Gleap's own hosts (`gleap.io` and `gleap.ai`, the domain of the [US data region](https://gleap-developer-docs.gleap.help/en/articles/711-data-regions)) are always excluded from the network logs, so you don't need to blacklist them yourself. The JavaScript SDK does this since **v18.0.0**, the iOS, Android, React Native, Flutter and Ionic Capacitor SDKs since **v19.0.0**.

To add a new entry to the blacklist, open your project in the [Gleap dashboard](https://app.gleap.ai), go to **Developer options** and add the URLs under **Network logs → Excluded domains**.

### Set blacklist with code

It's also possible to set the network log blacklist by code. Each call replaces the previous list. The domains set in the dashboard apply in addition.

**Swift**

```swift
Gleap.setNetworkLogsBlacklist(["analytics.example.com", "..."])
```

**Objective-C**

```objectivec
[Gleap setNetworkLogsBlacklist: @[@"analytics.example.com", @"..."]];
```

## Related

- [iOS SDK setup](https://docs.gleap.ai/en/articles/434-ios-sdk-setup.md)
- [iOS SDK: User identity](https://docs.gleap.ai/en/articles/435-ios-sdk-user-identity.md)
- [iOS SDK: Callbacks](https://docs.gleap.ai/en/articles/436-ios-sdk-callbacks.md)
- [iOS SDK: Frontend tools](https://docs.gleap.ai/en/articles/437-ios-sdk-frontend-tools.md)
- [iOS SDK: Forms](https://docs.gleap.ai/en/articles/438-ios-sdk-forms.md)
