In DataStream 2, you can activate a stream upon creating or save the configuration to activate at any time. Both require getting details necessary to configure a stream, including product and group IDs, destination for streaming logs, or data set fields you want to monitor.

Get stream details

Before creating a new or updating an existing stream, use this workflow to get the required details:

  1. Decide on the log type for your stream. You can gather and get logs for delivery products, EdgeWorkers, Edge DNS, and Global Traffic Management. For details on each, see Log types.

  2. Run the List groups operation to determine the group that you want to create a stream for.

  3. Depending on the log type, run the List CDN properties by group, List Edge DNS zones by contract or List GTM properties by contract operation to determine the delivery or GTM properties, or Edge DNS zones within the selected group or contact that you want to monitor in the stream.
    Note that running this request returns only active properties. To list a property, activate it on the production network in Property Manager first. For steps, see Activate a property in the Property Manager API guide.

  4. Run the List data set fields operation to get the list of parameters and metrics you can collect for each log type, and choose the data set fields that you want the stream to log.

Create and activate a stream

If you want to activate your stream on making the POST or PUT request, use this basic workflow:

  1. Depending on the stream log type, run one of these operations to create and configure a stream:

  2. Enable the datastream behavior in Property Manager to start collecting and streaming logs.

  3. Optionally, set the sample rate in the datastream behavior to control the percentage of data you want to collect and stream.

Create and save a stream configuration

If you want to save your stream configuration and activate it later, use this basic workflow:

  1. Depending on the stream log type, run one of these operations to create and configure a stream:

  2. When you decide the configuration is ready for activation, run the Activate a stream operation.

  3. Enable the datastream behavior in Property Manager to start collecting and streaming logs.

  4. Optionally, set the sample rate in the DataStream behavior to control the percentage of data you want to collect and stream.

Next, you can configure these optional behaviors and criteria to have better control over your stream:

  • Custom log fields. Enable to log any of these data set fields: User-Agent, Accept-Language, Cookie, Referer, X-Forwarded-For, or Custom field. See Custom log field.

  • Criteria. In each property that's part of the stream, you can configure the DataStream behavior in a custom rule to log requests matching your criteria. This lets you filter by hostnames, paths, IP addresses, or other criteria. See Criteria in Property Manager.

Editing a stream

If you want to edit a stream, run the Patch a stream operation (for selected elements of the stream, including the desitnation details or data ser fields) or one of the stream editing the operations, depending on your log type: