logzio / logzio-azure-serverless

Azure function that ships Logs to logz.io
Apache License 2.0
10 stars 12 forks source link
integration

logzio-azure-serverless

This repo contains the code and instructions you'll need to ship logs and metrics from your Azure services to Logz.io. At the end of this process, your Azure function will forward logs or metrics from an Azure Event Hub to your Logz.io account.

Note: The metrics solution is deprecated and only works with the elastic-based Logz.io metrics product.

Integration-architecture

Setting log shipping from Azure

1. Deploy the Logz.io template👇

Deploy to Azure

This deployment will create the following services:

2. Configure the template

Make sure to use these settings:

Parameter Description
Resource group* Create a new resource group or select your existing one, and then click OK.
Region* Select the same region as the Azure services that will stream data to this event hub.
Debug* Add debug logs to your function app.
Shipping token* Add the logs shipping token or metrics shipping token for the relevant Logz.io account. This is the account you want to ship to.
Logs listener host* (Default: listener.logz.io) Use the listener URL specific to the region of your Logz.io account. You can look it up here.
buffersize (Default: 100) The maximum number of messages the logger will accumulate before sending them all as a bulk

For all other parameters; to use your existing services, change the parameter to the relevant service's name. Otherwise, the template will build the necessary services automatically.

*Required fields.

At the bottom of the page, select Review + Create, and then click Create to deploy.

Deployment can take a few minutes.

3. Stream Azure service data to your new event hubs

Now that you've set it up, configure Azure to stream service logs/metrics to your new event hubs so that your new function apps can forward that data to Logz.io. To send your data to this event hub choose your service type and create diagnostic settings for it.
Under 'Event hub policy name' choose 'LogzioLSharedAccessKey' for logs and 'LogzioMSharedAccessKey' for metrics. This settings may take time to be applied and some of the services may need to be restarted.
For more information see Stream Azure monitoring data to an event hub for consumption by an external tool from Microsoft.

Diagnostic-settings

4. Check Logz.io for your data

Give your data some time to get from your system to ours, and then open Logz.io. If everything went according to plan, you should see logs with the type eventHub in Kibana, or metrics with the type eventHub in Grafana.

Backing up your logs!

This deployment will also back up your data in case of connection or shipping errors. In that case the logs that weren't shipped to Logz.io will be uploaded to the blob storage 'logziologsbackupstorage' under the container 'logziologsbackupcontainer'.

Working with your parameters after deployment

If you wish to change parameters values after the deployment, go to your function app page, then on the left menu press the 'Configuration' tab. You'll have the option to edit the following values:

Function's configuration

Migration to Log Analytics Workspace-Based Model

For users currently on the Classic Application Insights, it's essential to migrate to the Log Analytics workspace-based model. To do this:

  1. Navigate to your Application Insights resource that hasn't been migrated yet.
  2. Click on the notification that states "Classic Application Insights is deprecated."
  3. A "Migrate to Workspace-based" dialog will appear. Here, confirm your preferred Log Analytics Workspace and click 'Apply'.

Important: Be aware that once you migrate to a workspace-based model, the process cannot be reversed.

Changelog