> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/upg/2.16/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/upg/2.16/features/memcap.md).

# MEMCAP traffic capturing

User Plane Gateway (UPG) extends the Fast Path Provider (FPP) [MEMCAP integration](https://docs.cennso.com/components/fpp/1.3/memcap.md) to allow for capturing session traffic based on provided IMSI (International Mobile Subscriber Identity).

For the details about MEMCAP and its installation, refer to the FPP [MEMCAP traffic capturing](https://docs.cennso.com/components/fpp/1.3/memcap.md#installation) documentation. After installing MEMCAP Sink, no additional configuration is required on the UPG side. The system is designed to maintain a continuous connection with the MEMCAP Sink pod, automatically attempting to reconnect, if necessary.

## Usage

### Enable traffic capturing

To initiate traffic capturing on a specific IMSI, use the command:

```
vppctl upf memcap session imsi ${IMSI} target ${TARGET_NAME} [packet_max_bytes 9000]
```

The `packet_max_bytes` parameter is optional and it allows you to limit the size of collected data to reduce memory usage of traffic capture.

### Disable traffic capturing

To disable traffic capturing on a specific IMSI, use the command:
```

vppctl upf memcap session imsi IMSI disable
```

## Capture information

You can use the [additional metadata](https://docs.cennso.com/components/fpp/1.3/memcap.md#capture-information) provided in a `.pcapng` file for advanced filters in tools like Wireshark. When analyzing `.pcapng` files collected using MEMCAP in Wireshark, the IMSI associated with each packet is displayed in the `frame.interface_name` field.

Packets are captured immediately after the Packet Detection Rule (PDR) matching and before any processing by Usage Reporting Rule (URR) or Quality of Experience Rule (QER). This means packets are captured before potential drops due to various gateway control functions.

>**NOTE:** Multiple sessions can share same IMSI and currently there is no way to distinguish traffic between them.
