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 raise incidents for the same situations the Wazuh rules alert on.

In short

Run a Linux log forwarder with rsyslog and the Azure Monitor Agent, let rsyslog terminate TLS on port 6514, add a forwarder in the console, and save the parser function in the workspace. The events then arrive in the Syslog table, and analytics rules raise incidents.

Goal

Get XplicitTrust events into a Microsoft Sentinel workspace as columns you can query, and raise incidents for brute force, logins from two countries, mass deletion, protections switched off and a silent forwarder.

Architecture

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.

Prerequisites

  • 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.

Steps

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 → SIEM → 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

Verify

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

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)
    

The analytics rules, with their queries, schedules, severities and MITRE ATT&CK techniques, are on the Detections page. They count events with dcount(EventId), as the notes above say, and include one that alerts when a forwarder has sent no heartbeat for 20 minutes.

Troubleshooting

What you see Cause and fix
Nothing arrives in the Syslog table Check that the Azure Monitor Agent listens on port 28330 (ss -lntp, look for port 28330), that the data collection rule collects LOG_LOCAL0 at LOG_INFO, and the certificate from outside (step 2).
The forwarder fails with a certificate error The certificate must come from a publicly trusted CA and match the forwarder name; Verify return code: 0 (ok) in step 2. Self-signed certificates are not accepted.
rsyslog logs a permission error for the certificate files (Ubuntu) The AppArmor profile; see the end of step 2.
Decoded is false in XplicitTrustEvents The message was cut off on the way. Raise rsyslog's message size limit to 64 KB (step 2).
The same event is counted twice Delivery is at-least-once. Count with dcount(EventId), not count().

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.

See also