Associate workloads with a stream
Choose the workloads a Data Stream stream collects logs from, in Azion Console or with the Azion API, and confirm the stream sends them.
You can associate workloads with a Data Stream stream from Azion Console or with the Azion API. To collect from every workload with sampling instead, refer to Configure sampling on a stream.
A stream collects the logs of the workloads associated with it and sends them to its endpoint. One stream can collect from a single workload or from several. Unlike sampling, a workload filter leaves your other streams active. For every field of the filter, refer to Stream settings.
Select your interface once. The prerequisites and every task below show only that path.
Prerequisites
- One or more workloads on your account.
- The Edit Data Stream permission. For details, refer to Stream settings.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
- An account with fewer than 3,000 workloads. At 3,000 workloads or more, the Console blocks the stream forms, and you manage streams through the API only.
Create a stream for your workloads
You choose the workloads in the same form that sets the stream’s data source, template, and endpoint. The example uses the Applications data source. Activity History events belong to the account rather than to a workload, so an Activity History stream uses sampling instead.
To create the stream with the API, send a POST request with a filter_workloads item in transform. Replace [TOKEN VALUE] with your personal token, <workload-id> with the ID of your workload, and the endpoint values with your own:
The workloads data source is Applications in the Console, and template 2 is Applications Event Collector. To collect from several workloads, list their IDs in workloads, from 1 to 600. The API answers 201 with the stored stream:
The transform array holds the workload filter you sent. An ID that is not a workload on your account is refused with 400:
The API has no option for every workload. A stream without filter_workloads needs a sampling item, and saving it deactivates every other stream on the account. For that path, refer to Configure sampling on a stream.
The stream saves without contacting the endpoint, and an activation takes effect after one to two minutes.
Confirm the delivery
Real-Time Events records every send of a stream, delivered or not, with the status code the endpoint returned. Send a few requests to a chosen workload, then wait about a minute.
To read the sends with the API, query the dataStreamedEvents dataset of the Real-Time Events GraphQL API. Replace the dates with a range that covers the activation of the stream:
The API answers 200 with one record for each send, the latest first:
A statusCode of 200 means the endpoint accepted the batch, and streamedLines counts the log lines it carried. An empty dataStreamedEvents list means the stream has not sent in the range.
A status other than 200 is the answer of the endpoint, and 503 means Data Stream found the endpoint unavailable. For the causes, refer to Troubleshoot Data Stream.