Skip to main content

pcaps

Creates, updates, deletes, gets or lists a pcaps resource.

Overview

Namepcaps
TypeResource
Idcloudflare.magic_transit.pcaps

Fields

The following fields are returned by SELECT queries:

List packet capture requests response.

NameDatatypeDescription
idstringThe ID for the packet capture. (example: 66802ca5668e47a2b82c2e6746e45037)
colo_namestringThe name of the data center used for the packet capture. This can be a specific colo (ord02) or a multi-colo name (ORD). This field only applies to full packet captures. (example: ord02)
byte_limitnumberThe maximum number of bytes to capture. This field only applies to full packet captures.
destination_confstringThe full URI for the bucket. This field only applies to full packet captures. (example: s3://pcaps-bucket?region=us-east-1)
error_messagestringAn error message that describes why the packet capture failed. This field only applies to full packet captures. (example: No packets matched the filter in the time limit given. Please modify the filter or try again.)
filter_v1objectThe packet capture filter. When this field is empty, all packets are captured.
offset_timestring (date-time)The RFC 3339 offset timestamp from which to query backwards for packets. Must be within the last 24h. When this field is empty, defaults to time of request. (example: 2020-01-01T08:00:00Z)
packets_capturedintegerThe number of packets captured.
statusstringThe status of the packet capture request. (unknown, success, pending, running, conversion_pending, conversion_running, complete, failed) (example: success)
stop_requestedstring (date-time)The RFC 3339 timestamp when stopping the packet capture was requested. This field only applies to full packet captures.
submittedstringThe RFC 3339 timestamp when the packet capture was created. (example: 2020-01-01T08:00:00Z)
systemstringThe system used to collect packet captures. (magic-transit) (example: magic-transit)
time_limitnumberThe packet capture duration in seconds.
typestringThe type of packet capture. Simple captures sampled packets, and full captures entire payloads and non-sampled packets. (simple, full) (example: simple)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectaccount_idLists all packet capture requests for an account.
createinsertaccount_id, system, time_limit, typeCreate new PCAP request for account.
create_ownershipexecaccount_id, destination_confAdds an AWS or GCP bucket to use with full packet captures.
stopexecpcap_id, account_idStop full PCAP.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
pcap_idstring

SELECT examples

Lists all packet capture requests for an account.

SELECT
id,
colo_name,
byte_limit,
destination_conf,
error_message,
filter_v1,
offset_time,
packets_captured,
status,
stop_requested,
submitted,
system,
time_limit,
type
FROM cloudflare.magic_transit.pcaps
WHERE account_id = '{{ account_id }}' -- required
;

INSERT examples

Create new PCAP request for account.

INSERT INTO cloudflare.magic_transit.pcaps (
filter_v1,
offset_time,
packet_limit,
system,
time_limit,
type,
byte_limit,
colo_name,
destination_conf,
account_id
)
SELECT
'{{ filter_v1 }}',
'{{ offset_time }}',
{{ packet_limit }},
'{{ system }}' /* required */,
{{ time_limit }} /* required */,
'{{ type }}' /* required */,
{{ byte_limit }},
'{{ colo_name }}',
'{{ destination_conf }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

Lifecycle Methods

Adds an AWS or GCP bucket to use with full packet captures.

EXEC cloudflare.magic_transit.pcaps.create_ownership
@account_id='{{ account_id }}' --required
@@json=
'{
"destination_conf": "{{ destination_conf }}"
}'
;