Microsoft Azure Functions

Microsoft Azure is one of the major cloud platforms that is being used nowadays. Coralogix works on making the integration with these cloud platforms as easy as possible. To get the most of  your cloud login and to get up and running as quickly as possible, follow the steps below.

There are some prerequisite for this seamless integration:

Installation

Clone the repo below.

git clone https://github.com/coralogix/coralogix-azure-serverless.git
cd coralogix-azure-serverless/

Login to Azure Cli

$az login

Install Azure Functions Core Tools

$make functools

Configure (Replace environment variables with appropriate values) and install Coralogix function for Azure Functions:

$ export AZURE_REGION=YOUR_REGION
$ export AZURE_FUNCTION_NAME=coralogixblob
$ export AZURE_STORAGE_CONNECTION=

$ export CORALOGIX_PRIVATE_KEY=YOUR_PRIVATE_KEY
$ export CORALOGIX_APP_NAME=APP_NAME
$ export CORALOGIX_SUB_SYSTEM=SUB_NAME

Private Key – A unique ID which represents your company, this Id will be sent to your mail once you register to Coralogix.

Application Name – The name of your main application, for example, a company named “SuperData” would probably insert the “SuperData” string parameter or if they want to debug their test environment they might insert the “SuperData– Test”.

SubSystem Name – Your application probably has multiple subsystems, for example: Backend servers, Middleware, Frontend servers etc. in order to help you examine the data you need, inserting the subsystem parameter is vital.

$ make install
$ make configure
$ make publish

The <YOUR_STORAGE_ACCOUNT_CONNECTION_STRING>  should be replaced with Storage Account connection string which you can find in Storage Account -> Access keys -> Connection string. It should look like:

DefaultEndpointsProtocol=https;AccountName=YOUR_ACCOUNT;AccountKey=YOUR_ACCOUNT_KEY;EndpointSuffix=core.windows.net

For more information about the configuration please see below.

BlobStorage

By default BlobStorage function will be triggered when you upload files to logs container in your Storage Account. You can change this to your custom container name in file BlobStorage/function.json (bindings.path parameter):

{
  "scriptFile": "../dist/BlobStorage/index.js",
  "disabled": false,
  "bindings": [
    {
      "name": "blob",
      "type": "blobTrigger",
      "direction": "in",
      "path": "<YOUR_CONTAINER_NAME>/{name}",
      "connection":"InputStorage"
    }
  ]
}

 

If you store multiline data, just export NEWLINE_PATTERN environment variable with regex for line splitting and execute.

The new line pattern is exported by default. You can use the environment variable below to make sure the new line pattern is supported.

export NEWLINE_PATTERN="(?:\r\n|\r|\n)"
$ make configure