Lesson 5 of 7 Microsoft Sentinel Collection

Collecting Syslog and CEF Events

This lesson explains the log forwarder pattern, the two connectors, and how to avoid duplicates.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish Syslog from CEF.
  • Describe the log forwarder.
  • Configure a data collection rule.
  • Prevent duplicate data.

Syslog and CEF

Syslog is the standard logging protocol on Linux and on many network devices. Messages have a facility, which names the source type, such as auth or local4, and a severity. The message itself is usually free text. Common Event Format (CEF) is a structured format, carried inside a Syslog message, that many security appliances use. CEF fields have defined names, so a query can use them directly.

The following comparison shows how they map into Microsoft Sentinel.

Syslog
FormatFree text
ConnectorSyslog via AMA
Destination tableSyslog
Typical sourceLinux servers
CEF
FormatStructured key-value pairs
ConnectorCommon Event Format (CEF) via AMA
Destination tableCommonSecurityLog
Typical sourceFirewalls and security appliances
Sort into groups

Syslog or CEF?

Exam skills 4.2.5

Decide whether each statement describes Syslog or CEF collection.

Log in to try this activity Interactive activities are free with an account.

The log forwarder pattern

A firewall cannot run an agent, so it sends logs to something that can. A log forwarder is a Linux machine running rsyslog or syslog-ng, with the Azure Monitor Agent (AMA). A Linux server that needs to collect its own logs can use AMA directly.

  1. Device

    The appliance sends messages to the forwarder on port 514, over UDP or TCP.

  2. Daemon

    rsyslog or syslog-ng receives them.

  3. Agent

    The daemon passes them to AMA, on TCP port 28330 from AMA 1.28.11 onwards.

  4. Rule

    A DCR selects facilities and severities.

  5. Workspace

    Events land in the Syslog or CommonSecurityLog table.

The forwarder needs Python 2.7 or 3, and if it is not an Azure VM, then it needs the Azure Arc Connected Machine agent. The installer script is Forwarder_AMA_installer.py. The Log Analytics agent has been retired, so any design based on it is out of date. Test data can take up to 20 minutes to appear.

The following diagram follows a message from an appliance to a table.

The log forwarder pattern for Syslog and CEF. An appliance that cannot run an agent sends messages to a Linux forwarder on port 514 over UDP or TCP. rsyslog or syslog-ng receives them and passes them to the Azure Monitor Agent on TCP port 28330. A data collection rule selects facilities and severities, and events land in the Syslog or CommonSecurityLog table. A forwarder outside Azure also needs the Azure Arc Connected Machine agent.
The forwarder runs the agent the appliance cannot.
Put in order

A message through the forwarder

Exam skills 4.2.5

Put the stages of CEF collection through a log forwarder in order.

Log in to try this activity Interactive activities are free with an account.

Configuring the data collection rule

Configuring the connector creates a DCR, which selects machines as well as facilities and minimum severities. Rights are needed: Virtual Machine Contributor or Azure Connected Machine Resource Administrator to deploy the agent, and Monitoring Contributor to create or edit DCRs.

A forwarder should sit near its sources, with enough capacity. Use two or more forwarders behind a load balancer for resilience, because a Syslog sender using UDP has no way of knowing that a message was lost. Protect the forwarder as a security system, and allow port 514 only from the expected sources.

Avoiding duplicates

A common problem is that the same event lands in both tables. If a device writes CEF to a facility, and the Syslog DCR collects the same facility, then both connectors can ingest the same message, which doubles the ingestion cost and confuses analysts. There are three ways of preventing this.

  • Use separate facilities at the source, one for CEF and another for Syslog.
  • Use separate forwarders.
  • Filter out unwanted messages with a transformation in the DCR.

A transformation is a KQL statement that runs during ingestion. It can drop noisy events to control cost. When filtering for CEF traffic, Microsoft notes that both ProcessName and SyslogMessage should be checked.

Select all that apply

Preventing duplicate events

Exam skills 4.2.5

Identify the ways to stop the same event landing in both tables.

Log in to try this activity Interactive activities are free with an account.

Testing

After setting up, send a test message from the forwarder and run a query.

logger -p local4.warn -t CEF "CEF:0|Contoso|Firewall|1.0|100|Test event|5|src=203.0.113.10 dst=10.0.0.4"
CommonSecurityLog
| where DeviceVendor == "Contoso"
| project TimeGenerated, DeviceVendor, Activity, SourceIP, DestinationIP

If nothing appears, check in order that the daemon receives messages, that the agent is running, that the DCR is associated with the machine, and that the facility is included.

Worked example

Duplicated rows

A firewall sends CEF to a Linux forwarder on facility local4. Both the Syslog via AMA and CEF via AMA connectors are configured on the forwarder, and local4 is selected in each one. Ingestion costs have doubled, and the same events appear in two tables. What should you change?

Remove local4 from the Syslog DCR, so that those messages go only to CommonSecurityLog, or add a transformation to the Syslog rule that filters out CEF messages. Keep the CEF connector, as its structured data suits analytics rules.

Deleting the CEF connector would lose the structured fields. Moving the table to a cheaper tier would reduce cost, but it would leave the duplicates. Adding a second forwarder would not stop either rule from collecting the same facility.

Check yourself

Why can Syslog messages over UDP be lost without notice?

Show answer

UDP has no acknowledgement, so a sender cannot tell whether the forwarder received a message.

Exam Tips

Remember for the exam

  • Syslog goes to the Syslog table; CEF goes to CommonSecurityLog.
  • A forwarder runs rsyslog or syslog-ng with AMA, and listens on port 514.
  • Non-Azure forwarders need Azure Arc.
  • Use separate facilities or a transformation to prevent duplicates.