Collect data from Linux-based sources using syslog
Configuring the Azure Monitor Agent for Syslog on Linux machines:
For an Azure Linux VM:
To install the agent on an Azure Linux virtual machine:
In the Azure portal, enter Monitor in the
Search resources, services, and docs
search bar.In Monitor, scroll down the left menu to the Settings section and select
Data Collection Rules
.In Monitor | Data Collection Rules, select + Create.
On the
Data Collection Rule
Basics tab, enter a Rule name and specify a Subscription, Resource Group, Region, and Platform Type. For this exercise, selectLinux
for Platform Type.Select Next:Resources
On the
Data Collection Rule
Resources tab, select + Add resources.In the Select a scope page, expand the Scope column for
Subscription
andResource group
types until your target VM is displayed.Select the target VM and select Apply. You should see your Linux VM displayed as a Resource.
Select Next: Collect and deliver.
On the
Data Collection Rule
Collect and deliver tab, select + Add data source.In the Add data source page, select Linux Syslog from the
Data source type*
drop-down menu, and select Add data source. You should see yourLinux Syslog
Data source and aDestinations(s)
ofAzure Monitor Logs
displayed.Select Review + create, and Create after Validation passed is displayed.
Note
This process initiates the Azure Monitor Linux Agent extension install.
After the process completes, locate Virtual Machines in the Azure portal and select the Linux VM you configured as a
Data Collection Rule
resource.On the
Virtual machine
Overview, scroll down the left menu to the Settings section and select Extensions + applications.Under the Extensions tab, you should see the AzureMonitorLinuxAgent displayed.
Note
If Microsoft Defender for Cloud Auto-provisioning is enabled, the Azure Monitor Linux Agent will be installed by default as an extension using Azure Policy assignment.
For any other Linux machine:
To install the agent on non-Azure Linux physical or virtual machines:
In the Azure portal, enter Arc in the
Search resources, services, and docs
search bar.In Azure Arc, scroll down the left menu to the Infrastructure section and select Servers.
On the Servers page, select + Add.
On the Add servers with Azure Arc page, locate the Add a single server box and select Generate script.
On the Add servers with Azure Arc page, Prerequisites tab, review the requirements and select Next.
On the Add servers with Azure Arc page, Resource details tab, select your Subscription and Resource group from the drop-down menus under Project details.
Tip
Select an Azure region before creating a new Resource groups.
On the Add servers with Azure Arc page, Resource details tab, select your Region and then select Linux from the Operating system drop-down menu under Server details.
On the Add servers with Azure Arc page, Resource details tab, select the appropriate Connectivity method from the radio buttons under Connectivity method, and then select Next.
On the Add servers with Azure Arc page, Tags tab, enter
Physical locations tags
as needed and select Next.On the Add servers with Azure Arc page, Download and run script tab, either download or copy the script to the clipboard.
Tip
If you're using a Microsoft Windows system with Microsoft Azure, it is easy to copy and paste the script into notepad, then ssh into your Linux machine with PowerShell to run the script in a Bash console.
Open a
Bash console
as an administrative (root) user on your non-Azure Linux machine and run the script.This script does the following:
- Download an installation script from the Microsoft Download Center.
- Configure the package manager to use and trust the packages.microsoft.com repository.
- Download the agent from Microsoft's Linux Software Repository.
- Install the agent on the server.
- Create the Azure Arc-enabled server resource and associate it with the agent.
When the script successfully completes you should see a message stating
Latest version of azcmagent is installed
.On the Add servers with Azure Arc page, Download and run script tab, select Close.
The next step is to connect your non-Azure Linux server
azcmagent
to Azure Arc.Copy and edit the following Bash script to include the required parameters in double quotes:
azcmagent connect --resource-group "resourceGroupName" --tenant-id "tenantID" --location "regionName" --subscription-id "subscriptionID" --cloud "cloudName" if [ $? = 0 ]; then echo "\033[33mTo view your onboarded server(s), navigate to https://portal.azure.com/#blade/HubsExtension/BrowseResource/resourceType/Microsoft.HybridCompute%2Fmachines\033[m"; fi
Tip
You can use the export (variables) entries from the agent install script you downloaded or copied to fill in the parameters required in the agent connect script.
When the script editing is complete, open a
Bash console
as an administrative (root) user on your non-Azure Linux machine and run the script.The script tests connectivity to Azure endpoints and then requests you to sign in to
https://microsoft.com/devicelogin
and enter the supplied code to authenticate.Open a Web browser and navigate to the address as directed, and paste or enter the code into the form and select Next to sign in.
On the Pick an account page, select your
administrator account
and then select Next. Close browser tabs when complete.In your
Bash console
you should see anINFO Connected machine to Azure
message.Verify your non-Azure machine is connected to Azure Arc in the Azure portal by entering Arc in the
Search resources, services, and docs
search bar.In Azure Arc, scroll down the left menu to the Infrastructure section and select Servers. You should see your machine with a
Status
of Connected.Note
Select Refresh if the Linux machine is not displayed.
The next task is to add your newly connected Azure Arc Linux server to your previously created Data Collection Rule for Syslog.
In the Azure portal, enter DCR in the
Search resources, services, and docs
search bar.Select your Syslog Data Collection Rule
In your
Data Collection Rule
, scroll down the left menu to the Configuration section and select Resources.In Resources select + Add
In the Select a scope page, expand the Scope column until your Server - Azure Arc
Resource type
newly connected Linux machine is displayed.Select the Linux Azure Arc machine and select Apply
The Linux Azure Arc VM is now included as one of the
Data Collection Rule
Resources.