Send logs to Azure Blob Storage
Create a stream that writes the logs of your applications to an Azure Blob Storage container, in Azion Console or with the Azion API, and confirm the delivery.
You can send the logs of a stream to an Azure Blob Storage container from Azion Console or with the Azion API. To send them to a workspace in Azure Monitor instead, refer to Send logs to Azure Monitor.
Data Stream writes the log lines to a container of your Azure storage account. The stream form sets the endpoint in the field labeled Connector, where Azure Blob Storage is the Azure Blob Storage option. For every field and its bounds, refer to Endpoints.
The example collects the requests of one workload with the Applications data source.
Prerequisites
Console
- An Azion account with the Edit Data Stream permission. For the permissions, refer to Stream settings.
- A workload on the account that receives requests.
- An Azure storage account and its name, such as
mystorageaccount. - A container in the storage account. The container must exist before the stream sends to it.
- A shared access signature (SAS) token for the container, with the create, read, write, and list permissions.
- Access to Azion Console. To sign in, refer to How to access Azion Console.
Create the stream
A workload filter selects the workload the stream collects from. Your other streams stay active, which is not the case with sampling.
Console
To create the stream in Azion Console:
Access Azion Console > Data Stream.
In the General section, enter a Name. For example: logs-to-azure-blob.
In the Input section, select Applications in Data Source.
In the Transform section, turn off Sampling while Option is still All Current and Future Workloads, its starting value. A stream cannot carry sampling and a workload filter together.
In the Transform section, set Option to Filter Workloads. Select your workload in Available Workload, then use the arrow to move it to Chosen Workload. If your Console names domains where this guide names workloads, the same control reads Filter Domains. The pick list then reads Available Domain and Chosen Domain.
In the Render Template section, select Applications Event Collector in Template.
In the Output section, select Azure Blob Storage in Connector.
Enter the name of the storage account in Storage Account, such as mystorageaccount. Enter the name of the container in Container Name, such as azion-logs.
Paste the SAS token of the container in Blob SAS Token.
In the Status section, keep Active turned on.
The Console shows Your data stream has been created. The Data Stream list shows the stream with Azure Blob Storage in the Connector column and the Active status.
Neither the API nor the Console contacts the container when it saves the stream. A wrong storage account, container name, or SAS token appears only when the stream sends. An activation takes effect after one to two minutes.
Confirm the delivery
Real-Time Events records every send of a stream, with the status code the endpoint returned, whether the send succeeds or fails. Send a few requests to the workload, then wait about a minute. A stream sends a batch every 60 seconds, or earlier when the batch reaches 2,000 log lines.
Console
To find the sends in Azion Console:
Access Azion Console > Real-Time Events.
Each row is one send. Find the rows with AZURE_BLOB_STORAGE in Endpoint Type, and read their Status Code.
A Status Code of 200 means the container accepted the batch. Streamed Lines gives the number of log lines in the batch.
A status other than 200 comes from the endpoint, except 503, which means Data Stream found the endpoint unavailable. For the causes, refer to Troubleshoot Data Stream.