Data Stream quickstart
Stream your account's Activity History to an Object Storage bucket with Data Stream, in Azion Console or the API, and confirm the first log lines arrive.
This guide instructs you through sending your first logs with Data Stream. By the end you will have:
- Your first stream, which sends the Activity History of your account to an Object Storage bucket.
- An Activity History event that you produce yourself.
- The first log lines stored as an object in the bucket, which confirms the delivery.
The guide uses Activity History because any change you make in the account produces an event. You trigger the delivery yourself, and you need no account outside Azion.
The result rests on four objects, in this order:
- An Object Storage bucket receives the logs, and an Object Storage credential lets Data Stream write to it. You create both before you start.
- The stream collects the logs of one data source, Activity History. It sends every event, with sampling at 100%. The Activity History Collector template shapes each event into one log line. The endpoint is Simple Storage Service (S3), pointed at the bucket. The Console labels the endpoint field Connector.
- An event: a change you make in the account, which Activity History records.
- An object in the bucket that holds the log lines of that event.
Each setting of the stream is described on Stream settings.
Select the interface you will use. The prerequisites and every stage below follow that choice.
Prerequisites
- An Azion account. To create one, refer to Create an account.
- The Edit Data Stream permission on the account, which allows creating, editing, and deleting streams. For more information, refer to Teams Permissions.
- An Object Storage bucket. To create one, refer to Object Storage quickstart.
- An Object Storage credential that reaches the bucket, with four capabilities: List Files, Write Files, List All Bucket Names, and List Buckets. In the API, these are
listFiles,writeFiles,listAllBucketNames, andlistBuckets. Without the two bucket-list capabilities, every send fails with status503and no object reaches the bucket. The secret key shows only once, when the credential is created. To create the credential, refer to S3 protocol compatibility credentials.
- Access to Azion Console. To sign in, refer to Access Azion Console.
Create the stream
The stream reads the Activity History data source, sends every event, and writes the log lines to the bucket. A stream needs either sampling or a workload filter; this one keeps sampling on at 100%. To collect the logs of chosen workloads instead, refer to Stream settings.
To create the stream with the Azion API, send a POST request to the streams endpoint. Replace [TOKEN VALUE] with your personal token, <your-bucket> with the name of your bucket, and the two keys with the keys of your credential:
Template 251 is Activity History Collector. A 201 carries the stream:
The stream exists and is active. Keep the value of id, which identifies the stream in the next stage. A request without the sampling item fails with 400 and the code 32002, Workloads Must Be Provided.
Saving the stream checks the format of each field. It does not contact the bucket, so a wrong key shows only as a failed send.
Generate an event
A stream starts to send one to two minutes after you save it as active. Wait two minutes, then make one change in the account. Each save of the stream is an Activity History event, so renaming the stream is enough.
To rename the stream with the Azion API, send a PATCH request to the stream. Replace <stream-id> with the id of the stream you created:
A 200 carries the stream with the changed name and a later last_modified:
Activity History records the edit as one event.
Within about a minute of the event, Data Stream sends its log line to the bucket.
Confirm the logs arrived
Data Stream writes each send as one object. The object name is the prefix activity, a /, the date and time of the send in the YYYY/MM/DD/hh/mm/ format, and a UUID.
To list the objects in the bucket with the Azion API, send a GET request to the bucket. Replace <your-bucket> with the name of your bucket:
The response lists the object that the stream wrote, with its key, its time, and its size in bytes:
The object is in the bucket, which confirms that the stream delivered the event.
With Content Type plain/text, the object holds one Activity History record per line, as a JSON object. The keys are the ones the Activity History Collector template sets. One line, trimmed:
Your first stream delivers the Activity History of your account to the bucket. Every send, delivered or rejected, also leaves a record with its HTTP status in Real-Time Events.