Skip to content

Commit 985cfe7

Browse files
authored
Merge pull request #122087 from simathih/patch-3
Add note in Syslog docs on scenario when UDS is used
2 parents dadc7c6 + 02746ab commit 985cfe7

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

articles/azure-monitor/agents/data-collection-syslog.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ When the Azure Monitor agent for Linux is installed, it configures the local Sys
2020

2121
:::image type="content" source="media/azure-monitor-agent/linux-agent-syslog-communication.png" lightbox="media/azure-monitor-agent/linux-agent-syslog-communication.png" alt-text="Diagram that shows Syslog daemon and Azure Monitor Agent communication.":::
2222

23+
>[!Note]
24+
> Azure Monitor Agent uses a TCP port to receive messages sent by rsyslog or syslog-ng, however, in case SELinux is enabled and we aren't able to use semanage to add rules for the TCP port, we will use Unix sockets.
25+
26+
2327
The following facilities are supported with the Syslog collector:
2428
* None
2529
* Kern
@@ -147,7 +151,24 @@ queue.dequeueBatchSize="2048"
147151
queue.saveonshutdown="on"
148152
target="127.0.0.1" Port="28330" Protocol="tcp")
149153
```
150-
154+
155+
The following configuration is used when you use SELinux and we decide to use Unix sockets.
156+
```
157+
$ cat /etc/rsyslog.d/10-azuremonitoragent.conf
158+
# Azure Monitor Agent configuration: forward logs to azuremonitoragent
159+
$OMUxSockSocket /run/azuremonitoragent/default_syslog.socket
160+
template(name="AMA_RSYSLOG_TraditionalForwardFormat" type="string" string="<%PRI%>%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%")
161+
$OMUxSockDefaultTemplate AMA_RSYSLOG_TraditionalForwardFormat
162+
# Forwarding all events through Unix Domain Socket
163+
*.* :omuxsock:
164+
```
165+
166+
```
167+
$ cat /etc/rsyslog.d/05-azuremonitoragent-loadomuxsock.conf
168+
# Azure Monitor Agent configuration: load rsyslog forwarding module.
169+
$ModLoad omuxsock
170+
```
171+
151172
On some legacy systems, such as CentOS 7.3, we've seen rsyslog log formatting issues when a traditional forwarding format is used to send Syslog events to Azure Monitor Agent. For these systems, Azure Monitor Agent automatically places a legacy forwarder template instead:
152173

153174
`template(name="AMA_RSYSLOG_TraditionalForwardFormat" type="string" string="%TIMESTAMP% %HOSTNAME% %syslogtag%%msg:::sp-if-no-1st-sp%%msg%\n")`
@@ -177,6 +198,23 @@ log {
177198
flags(flow-control);
178199
};
179200
```
201+
The following configuration is used when you use SELinux and we decide to use Unix sockets.
202+
```
203+
$ cat /etc/syslog-ng/conf.d/azuremonitoragent.conf
204+
# Azure MDSD configuration: syslog forwarding config for mdsd agent options {};
205+
# during install time, we detect if s_src exist, if it does then we
206+
# replace it by appropriate source name like in redhat 's_sys'
207+
# Forwrding using unix domain socket
208+
destination d_azure_mdsd {
209+
unix-dgram("/run/azuremonitoragent/default_syslog.socket"
210+
flags(no_multi_line) );
211+
};
212+
213+
log {
214+
source(s_src); # will be automatically parsed from /etc/syslog-ng/syslog-ng.conf
215+
destination(d_azure_mdsd);
216+
};
217+
```
180218

181219
>[!Note]
182220
> Azure Monitor supports collection of messages sent by rsyslog or syslog-ng, where rsyslog is the default daemon. The default Syslog daemon on version 5 of Red Hat Enterprise Linux, CentOS, and Oracle Linux version (sysklog) isn't supported for Syslog event collection. To collect Syslog data from this version of these distributions, the rsyslog daemon should be installed and configured to replace sysklog.

0 commit comments

Comments
 (0)