Skip to content

Sending notifications via email

Write notifications in TeskaLabs SP-Lang. If you're writing a notification for a detection, write the email notification in the trigger section.

Important

For notifications that send emails, you need to create an email template in the Library to connect with. This template includes the actual text that the recipient will see, with blank fields that change based on what the detected activity is (using Jinja templating), including which logs are involved in the detection, and any other information you choose. The notification section in the detection rule is what populates the blank fields in the email template. You can use a single email template for multiple detection rules.

Example:

Use this example as a guide. Click the icons to learn what each line means.

trigger: #
  - notification: #
      type: email #
      template: "/Templates/Email/Notification.md" #
      to: [email@example.com] #
      variables: #
        !DICT #
        type: "{str:any}" #
        with: #
          name: Notification from the detection X #
          events: !ARG EVENTS #
          address: !ITEM EVENT client.address #
          description: Detection of X by TeskaLabs LogMan.io #

Populating the email template

name, events, address, and description are fields in the email template in this example. Always make sure that the keys you write in the with section match the fields in your email template.

notification and email template comparison

The fields name and description are static text values - they stay the same in every notification.

The fileds events and address are dynamic values - they change based on which logs caused a positive detection from the detection rule. You can write dynamic fields using TeskaLabs SP-Lang.

Refer to our directions for creating email templates to write templates that work correctly as notifications.