Skip to content

Microsoft Sentinel

XplicitTrust events reach Microsoft Sentinel as syslog, through the Azure Monitor Agent on a Linux log forwarder. The forwarder receives the event forwarder's syslog over TLS with rsyslog and hands the messages to the agent, which stores them in the workspace's Syslog table. A parser function turns the JSON body into columns, and the analytics rules below raise incidents for the same situations the Wazuh rules alert on.

XplicitTrust ──TLS :6514──▶ rsyslog ──TCP 127.0.0.1:28330──▶ Azure Monitor Agent ──▶ Syslog table
                            (log forwarder VM)

The HTTPS webhook cannot post to Sentinel directly. Azure's Logs Ingestion API accepts only short-lived Microsoft Entra tokens, and the webhook sends a fixed bearer token. Delivering webhooks to Sentinel needs a relay of your own (for example an Azure Function) that verifies the signature, fetches a token and calls the Logs Ingestion API; it is not covered here.

Requirements

  • A Log Analytics workspace with Microsoft Sentinel.
  • A Linux machine as log forwarder, reachable from the internet on TCP port 6514: an Azure VM, or a machine elsewhere with the Azure Arc Connected Machine agent. Ubuntu 22.04 or later, or RHEL 9 or later; the configuration below needs rsyslog 8.2108 or later and the rsyslog GnuTLS module (package rsyslog-gnutls).
  • A DNS name for the forwarder and a certificate for it from a publicly trusted CA, for example Let's Encrypt. The event forwarder does not accept self-signed certificates.

1. Connector and Data Collection Rule

  1. In Microsoft Sentinel, open Content hub, install the Syslog solution, then open Data connectors → Syslog via AMA → Open connector page.
  2. Create a Data Collection Rule. On Resources, select the log forwarder. On Collect, set LOG_LOCAL0 to LOG_INFO and leave the other facilities at none, unless you collect them anyway. The event forwarder sends every event with facility local0 and severity informational.
  3. On the log forwarder, run the forwarder installer from the connector page:

    sudo wget -O Forwarder_AMA_installer.py https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/DataConnectors/Syslog/Forwarder_AMA_installer.py && sudo python3 Forwarder_AMA_installer.py
    

    It configures rsyslog to listen on port 514 (UDP and TCP) and to hand messages to the agent. XplicitTrust does not use port 514: leave it closed in the network security group.

Creating the rule installs the Azure Monitor Agent on the forwarder. Check that it listens on port 28330 before continuing:

ss -lntp | grep 28330

2. TLS Input on the Forwarder

The Azure Monitor Agent does not accept TLS. rsyslog terminates it and relays each message to the agent, in a ruleset of its own, so the events reach neither the forwarder's own log files nor its other rules.

  1. Install the GnuTLS module: apt install rsyslog-gnutls (Ubuntu) or dnf install rsyslog-gnutls (RHEL).

  2. Raise rsyslog's message size limit to 64 KB, at the top of /etc/rsyslog.conf, before any module is loaded. rsyslog cuts messages off at 8 KB by default, and a cut-off message has invalid JSON. Most events are well below 2 KB, but a configuration change with many changed fields or a network discovery summary with many hosts can be larger.

    global(maxMessageSize="64k")
    
  3. Put the certificate and key where rsyslog can read them. With Let's Encrypt, a deploy hook copies them after every renewal and restarts rsyslog, which reads them only at startup. Save as /etc/letsencrypt/renewal-hooks/deploy/rsyslog-tls (mode 0755):

    #!/bin/sh
    # Copy the renewed certificate for rsyslog's TLS input and restart rsyslog.
    # Ubuntu runs rsyslog as user syslog; on RHEL it runs as root, use group root.
    set -e
    install -d -m 0750 -o root -g syslog /etc/rsyslog-tls
    install -m 0640 -o root -g syslog "$RENEWED_LINEAGE/fullchain.pem" "$RENEWED_LINEAGE/privkey.pem" /etc/rsyslog-tls/
    systemctl restart rsyslog
    

    Run it once by hand after requesting the certificate, with RENEWED_LINEAGE=/etc/letsencrypt/live/<forwarder name>. The event forwarder reconnects by itself after the restart.

  4. Create /etc/rsyslog.d/05-xplicittrust.conf:

    # XplicitTrust event forwarder: syslog over TLS on 6514, relayed to the
    # Azure Monitor Agent. imtcp is loaded by the forwarder installer in
    # /etc/rsyslog.conf; this file only adds an input to it.
    
    # The agent's own forwarding format: the syslog header the agent parses,
    # then the message, which is the event's JSON body.
    template(name="XplicitTrustToAMA" type="string"
        string="<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%")
    
    ruleset(name="xplicittrust") {
        # A disk-assisted queue keeps events while the agent restarts.
        action(type="omfwd" target="127.0.0.1" port="28330" protocol="tcp"
               template="XplicitTrustToAMA"
               queue.type="LinkedList" queue.filename="omfwd-xplicittrust"
               queue.maxDiskSpace="1g" queue.saveOnShutdown="on"
               action.resumeRetryCount="-1" action.resumeInterval="5")
    }
    
    input(type="imtcp" port="6514" ruleset="xplicittrust"
          streamDriver.name="gtls" streamDriver.mode="1" streamDriver.authMode="anon"
          streamDriver.certFile="/etc/rsyslog-tls/fullchain.pem"
          streamDriver.keyFile="/etc/rsyslog-tls/privkey.pem")
    

    authMode="anon" means rsyslog does not ask the sender for a client certificate; the event forwarder does not present one. rsyslog accepts the default Octet counting (RFC 5425) framing as well as newline-delimited messages.

  5. Check the configuration with rsyslogd -N1, restart rsyslog, and allow TCP 6514 inbound to the forwarder in its network security group or firewall. Then check the certificate from outside:

    openssl s_client -connect <forwarder name>:6514 -servername <forwarder name> </dev/null | grep -E 'subject|issuer|Verify return code'
    

    Verify return code: 0 (ok) is what the event forwarder needs as well.

    On Ubuntu, rsyslog runs under an AppArmor profile. If it logs a permission error for the certificate files (apparmor="DENIED" in journalctl -k), add /etc/rsyslog-tls/** r, to /etc/apparmor.d/local/usr.sbin.rsyslogd and reload the profile with apparmor_parser -r /etc/apparmor.d/usr.sbin.rsyslogd.

3. Event Forwarder

In the management console, add a forwarder under Settings → Event Forwarders:

Field Value
Protocol Syslog over TLS
URL <forwarder name>:6514
Framing Octet counting (RFC 5425)
Event Filters none, so the heartbeats and every event type arrive

Press Send Test Event and look for it in the workspace after a minute or two. Before the parser exists, query the table directly:

Syslog
| where Facility == "local0" and SyslogMessage has "xplicittrust"
| take 10

4. Parser Function

The agent stores the event's JSON body in SyslogMessage. The function below extracts it into columns. In the workspace, open Logs, paste the query, then Save → Save as function with the function name XplicitTrustEvents (category XplicitTrust). Analytics rules, hunting queries and workbooks then use XplicitTrustEvents like a table.

Syslog
| where Facility == "local0" and SyslogMessage has "xplicittrust"
| extend _Start = indexof(SyslogMessage, '{"xplicittrust":')
| extend Fields = iff(_Start >= 0, parse_json(substring(SyslogMessage, _Start)).xplicittrust, dynamic(null))
| extend
    EventId = tolong(Fields.event_id),
    EventClass = tostring(Fields.event_class),
    EventType = tostring(Fields.event_type),
    EventName = strcat(tostring(Fields.event_class), ".", tostring(Fields.event_type)),
    CreatedAt = todatetime(Fields.created_at),
    Message = tostring(Fields.message),
    SessionType = tostring(Fields.session_type),
    SessionId = tostring(Fields.session_id),
    TenantName = tostring(Fields.tenant_name),
    TenantId = tostring(coalesce(toguid(HostName), toguid(Computer))),
    ActorType = tostring(Fields.actor.type),
    ActorId = tostring(Fields.actor.id),
    ActorName = tostring(Fields.actor.name),
    UserEmail = tostring(Fields.user_email),
    ClientId = tostring(Fields.client),
    ClientName = tostring(Fields.client_name),
    RemoteAddress = tostring(Fields.remote_address),
    Country = tostring(Fields.country),
    City = tostring(Fields.city),
    ObjectType = tostring(Fields.object_type),
    ObjectId = tostring(Fields.object_id),
    ObjectName = tostring(Fields.object_name),
    Reason = tostring(Fields.reason),
    ClientIp = tostring(Fields.client_ip),
    Enabled = tobool(Fields.enabled),
    ChangedFields = Fields.changed_fields,
    NewValue = tostring(Fields.new_value),
    Decoded = isnotnull(Fields)
| project-away _Start

Notes:

  • Fields keeps the whole event, for fields without a column of their own: Fields.os.name, Fields.asn_organization, the per-class fields of the Event Reference.
  • TimeGenerated is set by the agent. CreatedAt is the time the event occurred, to the millisecond. Use CreatedAt when that time matters: after a forwarder outage the event forwarder delivers the backlog at once, and each event keeps its CreatedAt.
  • TenantId is the tenant's UUID. The JSON body names the tenant (tenant_name) but carries its id only in the syslog header, as the host name; the parser takes it from whichever host column of the Syslog table holds a UUID.
  • Delivery is at-least-once: after an outage an event can arrive twice, with the same EventId. Count events with dcount(EventId), as the rules below do, not count(). Heartbeats and test events have the id 0.
  • A message whose JSON could not be decoded has Decoded false and the raw text in SyslogMessage. It should not happen; if it does, the message was cut off on the way, see the size limit in step 2:

    XplicitTrustEvents
    | where not(Decoded)
    

5. Analytics Rules

Create each rule under Analytics → Create → Scheduled query rule, with the query, schedule and severity in the tables below. Map the entities so incidents group and link to the user, device and address:

Entity Identifier Column
Account FullName Account
Host HostName ClientName
IP Address RemoteAddress or ClientIp

Rules that do not return a column skip that entity. Set Event grouping to Trigger an alert for each event, so that each row (an account, a device, an address) becomes its own alert.

Rule Severity Run every Lookback MITRE ATT&CK Wazuh rule
Brute force against an account High 5 min 5 min T1110.001 117040
Brute force from an address High 5 min 5 min T1110 117047
Failed logins across accounts High 5 min 5 min T1110.003 117046
Repeated Web App login denials High 10 min 10 min T1110 117041
Logins from two countries within an hour High 1 hour 1 hour T1078 117042
Device denied access repeatedly High 10 min 10 min T1046 117043
Blocked logins from one address High 10 min 10 min T1110 117044
Mass deletion High 5 min 5 min T1485 117045
Disk encryption turned off High 5 min 5 min T1562 117038
Security product off or degraded Medium 5 min 5 min T1562.001 117028, 117039
Event forwarder disabled, deleted or redirected High 5 min 5 min T1562.008 117101–117103
Event forwarder silent High 5 min 1 day T1562.008 117087

The correlation rules count within the rule's lookback, so their windows are those of the Wazuh rules rounded up to a rule interval; the thresholds are the same.

Brute force against an account

XplicitTrustEvents
| where EventName == "authentication.failed"
| extend Account = coalesce(UserEmail, ActorName)
| summarize Failures = dcount(EventId), Addresses = make_set(RemoteAddress, 20), FirstSeen = min(CreatedAt), LastSeen = max(CreatedAt)
    by Account, TenantName
| where Failures >= 5

A failed login names the account that was tried, not necessarily who tried it.

Brute force from an address

XplicitTrustEvents
| where EventName == "authentication.failed" and RemoteAddress !in ("", "unknown")
| summarize Failures = dcount(EventId), Accounts = make_set(coalesce(UserEmail, ActorName), 20), FirstSeen = min(CreatedAt), LastSeen = max(CreatedAt)
    by RemoteAddress, TenantName
| where Failures >= 5

Failed logins across accounts

Password spraying, or an identity provider that fails for everyone.

XplicitTrustEvents
| where EventName == "authentication.failed"
| summarize Failures = dcount(EventId), Accounts = dcount(coalesce(UserEmail, ActorName)), Addresses = make_set(RemoteAddress, 20)
    by TenantName
| where Failures >= 10

Repeated Web App login denials

XplicitTrustEvents
| where EventName == "authentication.web_app_login_denied"
| extend Account = UserEmail
| summarize Denials = dcount(EventId), Apps = make_set(ObjectName, 20), Reasons = make_set(Reason, 10), RemoteAddress = take_any(RemoteAddress)
    by Account, TenantName
| where Denials >= 5

Logins from two countries within an hour

Shared credentials, a stolen session, or a VPN exit abroad.

XplicitTrustEvents
| where EventName == "authentication.logged_in" and ActorType == "user" and isnotempty(Country)
| extend Account = coalesce(UserEmail, ActorName)
| summarize Countries = make_set(Country), Addresses = make_set(RemoteAddress, 20), Devices = make_set(ClientName, 20)
    by Account, TenantName
| where array_length(Countries) >= 2

Device denied access repeatedly

A device that tries one destination after another: a scan from inside the network.

XplicitTrustEvents
| where EventName == "authorization.access_denied"
| summarize Denials = dcount(EventId), Reasons = make_set(Reason, 10), Account = take_any(UserEmail), RemoteAddress = take_any(RemoteAddress)
    by ClientId, ClientName, TenantName
| where Denials >= 5

Blocked logins from one address

Logins refused by the IP allowlist or the country restriction, from one address: someone probing from outside.

XplicitTrustEvents
| where EventName in ("access_control.ip_blocked", "access_control.geo_blocked")
| summarize Blocked = dcount(EventId), Accounts = make_set(coalesce(UserEmail, ActorName), 20), Countries = make_set(Country)
    by ClientIp, TenantName
| where Blocked >= 5

Mass deletion

XplicitTrustEvents
| where EventName == "configuration_change.deleted"
| extend Account = ActorName
| summarize Deleted = dcount(EventId), Objects = make_set(strcat(ObjectType, ": ", ObjectName), 50), RemoteAddress = take_any(RemoteAddress)
    by Account, ActorType, TenantName
| where Deleted >= 10

Disk encryption turned off

XplicitTrustEvents
| where EventName == "client_compliance.disk_encryption_changed" and NewValue == "off"
| project TimeGenerated, CreatedAt, TenantName, ClientId, ClientName, Account = UserEmail, OldValue = tostring(Fields.old_value), NewValue

Security product off or degraded

A security product that is now off, snoozed or expired, or an antivirus or firewall whose health dropped to poor.

XplicitTrustEvents
| where (EventName == "client_compliance.security_product_changed" and NewValue matches regex @"\(off/|snoozed|expired")
     or (EventName == "client_compliance.security_provider_changed" and NewValue == "poor")
| project TimeGenerated, CreatedAt, TenantName, ClientId, ClientName, Account = UserEmail, EventType, Setting = tostring(Fields.field), OldValue = tostring(Fields.old_value), NewValue

Event forwarder disabled, deleted or redirected

A forwarder that is switched off or pointed elsewhere delivers that change to its old destination before it stops. Changes to its event filters are included, since a filter can leave events out.

XplicitTrustEvents
| where EventClass == "configuration_change" and ObjectType == "event_forwarder"
| where EventType == "deleted"
     or (EventType == "updated" and (Enabled == false or tostring(ChangedFields) has_any ("protocol", "url", "event_filters")))
| project TimeGenerated, CreatedAt, TenantName, Forwarder = ObjectName, ForwarderId = ObjectId, EventType, Enabled, ChangedFields, Account = ActorName, RemoteAddress

Event forwarder silent

Forwarders send an event_forwarder.heartbeat every five minutes, whether or not there are events. This rule raises one alert when a forwarder that sent heartbeats has been silent for 20 minutes, unless it was disabled, deleted or redirected after its last heartbeat. Unlike the other rules it also catches an outage between XplicitTrust and the workspace: the log forwarder, rsyslog or the agent.

let Silence = 20m;
let RunEvery = 5m;
let Stopped = XplicitTrustEvents
    | where EventClass == "configuration_change" and ObjectType == "event_forwarder"
    | where EventType == "deleted" or (EventType == "updated" and (Enabled == false or tostring(ChangedFields) has_any ("protocol", "url")))
    | summarize StoppedAt = max(TimeGenerated) by ForwarderId = ObjectId;
XplicitTrustEvents
| where EventName == "event_forwarder.heartbeat"
| summarize arg_max(TimeGenerated, ObjectName, TenantName) by ForwarderId = ObjectId
| where TimeGenerated between (ago(Silence + RunEvery) .. ago(Silence))
| join kind=leftouter Stopped on ForwarderId
| where isnull(StoppedAt) or StoppedAt < TimeGenerated
| project LastHeartbeat = TimeGenerated, TenantName, Forwarder = ObjectName, ForwarderId

The time window makes each silence cross the 20-minute mark in exactly one run, so one outage gives one alert, however long it lasts. Keep Run every at 5 minutes, the value of RunEvery. Heartbeats amount to 288 small records per forwarder and day.

Field Reference

The fields of the JSON body are described under Syslog over TLS and, per event class, in the Event Reference. The agent keeps the syslog header in the Syslog table's own columns (Facility, SeverityLevel, ProcessName, the host name). The structured data of the RFC 5424 header does not reach the table; apart from the tenant id, which is also the host name, everything in it is in the JSON body as well.