> For the complete documentation index, see [llms.txt](https://docs.cennso.com/cennso/netcap/latest/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/cennso/netcap/latest/technical-reference/crds/netcapturejobs.md).

# NetCaptureJob Custom Resource Definition

`NetCaptureJob` Custom Resource (CR) is used to define the traffic capture configuration, including source interface(s), start time and duration, destination(s) for storing captured traffic, optional filtering or tagging parameters.

## Configuration example

This is a sample `NetCaptureJob` CR that you can use to capture PFCP traffic from the `sgi` interface and from IMSI `901406000520002` on the selected UPG instance:

```yaml
apiVersion: netcap.cennso.com/v1alpha1
kind: NetCaptureJob
metadata:
  name: interface-example
spec:
  forProvider:
    # Defines time schedule for traffic capturing
    schedule:
      # Specifies the start time for traffic capturing
      start: now
      # Specifies the end time for traffic capturing
      end: 12h

    streamTemplate:
      spec:
        cluster:
          # Names of Core Clusters to which this configuration should be applied
          name: test-cluster
          # Name of the namespace of the Core Cluster resource
          namespace: cennso-infra
        # Optional setting to select VPP instances to capture traffic from
        selector:
          # Name of the VPP pod to target
          name: vpp-deployment-name
          # Namespace where the target VPP pod is deployed
          namespace: test-ns
        # List of stream sources from where the stream will be captured
        sources:
        # Specifies an interface from which to capture traffic
        - interface:
            # Interface name
            name: "sgi"
            # Packet batching strategy
            batchingStrategy:
              # Number of packets to accumulate before sending a batch of packets
              packetsCount: 100
              # Time interval before sending a batch of packets
              duration: 10s
              # Number of bytes gathered before sending a batch of packets
              packetsBytes: 200
            # TCPDump filter to apply to the traffic capture
            filter: "arp or icmp"
            # NATS mode to use for sending and receiving NATS messages
            natsMode: pubsub
            # Defines label-based criteria for selecting VPP instances to capture traffic from
            match-labels:
              # Selects FPP/UPG instances that have NETCAP_APN: "test.cennso.com" defined
              apn: "test.cennso.com"
              # Selects FPP/UPG instances that have NETCAP_LANE: "lane-b" defined
              lane: lane-b
        - imsi:
            # Specifies IMSI for traffic capturing
            imsi: "901406000520002"
            # Packet batching strategy
            batchingStrategy:
              # Number of packets to accumulate before sending a batch of packets
              packetsCount: 100
              # Time interval before sending a batch of packets
              duration: 10s
              # Number of bytes gathered before sending a batch of packets
              packetsBytes: 200

    destinationTemplate:
      spec:
        # List of destinations where the aggregated stream will be forwarded
        destinations:
          # Parameters that define the PCAP file
          fileParams:
            # Defines the compression format
            compress: zstd
            # Maximum bytes per file
            max_bytes: 1073741824
            # Maximum number of files
            max_files: 10
            # Maximum number of packets per file
            max_packets: 10000
            # Enables file rotation, by default false
            rotate: true
            # Defines the rotation schedule at the beginning of every hour
            schedule: @hourly
          # Provides a reference to the PCAP storage
          storage:
            # Reference to the NetCaptureStorage CR
            name: storage-local
            # Prefix for the autogenerated name of the PCAP file
            prefix: upg
```

## Configuration parameters

These are all parameters that you can use to configure the `NetCaptureJob` CR:

**CRD specification:** [netcap.cennso.com_netcapturejobs.yaml](https://docs.cennso.com/api/spec/cennso/netcap/latest/assets/crds/netcap.cennso.com_netcapturejobs.yaml?form=bundled&kind=crd)
