The Datadog-Azure function is used to forward Azure logs to Datadog, including Activity and Diagnostic logs from EventHub.
The provided Node.js script must be deployed into your Azure Functions service. Follow the tutorial below to learn how to do so:
- Expand your function application and click the
+button next toFunctions. If this is the first function in your function application, selectCustom function. This displays the complete set of function templates. - In the search field type
Event Huband chooseEvent Hub Trigger. - Select the
Javascriptlanguage in the right menu. - Enter a name for the function.
- Add the wanted
Event Hub connectionor create a new one if you haven't have one already. - Select the
Event Hub consumer groupand theEvent Hub Nameyou want to pull logs from.
- Copy paste the code of the Datadog-Azure function.
- In the
Integratepart:Event Hub Cardinalitymust be set toMany.- Set the
Event Parameter NametoeventHubMessages.
Set the environment variable DD_SITE to datadoghq.eu and logs are automatically forwarded to your EU platform.
- API KEY:
There are 2 possibilities to set your Datadog's API key:
- Replace
<DATADOG_API_KEY>in the code with your API Key value. - Set the value through the
DD_API_KEYenvironment variable
- Custom Tags:
You have two options to add custom tags to your logs:
- Manually by editing the function code: Replace the
<TAG_KEY>:<TAG_VALUE>placeholder for theDD_TAGSvariable by a comma separated list of tags - Automatically with the
DD_TAGSenvironment variable
Learn more about Datadog tagging in our main Tagging documentation.