Logging with Windows VPC server instances
Use the IBM® Log Analysis service to monitor and manage logs from a Windows VPC server instance in a centralized logging system on the IBM Cloud.
As of 28 March 2024 the IBM Log Analysis and IBM Cloud Activity Tracker services are deprecated and will no longer be supported as of 30 March 2025. Customers will need to migrate to IBM Cloud Logs, which replaces these two services, prior to 30 March 2025. For information about IBM Cloud Logs, see the IBM Cloud Logs documentation.
You can collect and monitor system and application logs.
NXLog is used to provide log files to IBM® Log Analysis.
To configure NXLog, you must enable a port to send logs via syslog to your logging instance. If you are using (a) the classic syslog protocol, (b) a custom port in syslog-ng
, or (c) a custom port in rsyslog
, there is
no authentication available and anyone with knowledge of the endpoint can submit logs to your instance. As a result, depending on your environment, your use of the classic syslog protocol or custom port configurations with syslog-ng
or rsyslog
may present a significant security risk. Use these configurations at your organization's own risk. Validate with your compliance and security teams whether this security risk is acceptable to your organization.
By default, NXLog monitors log files in the C:\\ProgramData\\logs
directory.
On the IBM Cloud, configure an Windows server to forward logs to an IBM Log Analysis instance by completing the following steps:
- Provision a VPC running Windows.
- Provision an instance of the IBM Log Analysis service.
- Configure NXLog on the Windows server.
- Optionally, add additional directories to be monitored by the agent.
In this tutorial, you will learn how to configure a Windows server to forward logs to an IBM Log Analysis instance.
In this tutorial you will configure a Windows VPC server. See Logging with Windows Server systems for a tutorial on configuring an existing Windows Server system.
Before you begin
Read about IBM Log Analysis. For more information, see About.
Work in a supported region.
You can send data from an Windows instance that is located in the same region as your logging instance, in a different region, or not in the IBM Cloud.
Use a user ID that is a member, or an owner of, an IBM Cloud account. To get an IBM Cloud IBMID, go to: Create an account.
Your IBMID must have assigned IAM policies for each of the following resources in the region that your IBM Log Analysis instance is in:
Your IBMID must have assigned IAM policies for each of the following resources:
Resource | Scope of the access policy | Role | Region | Information |
---|---|---|---|---|
Resource group default | Resource group | Viewer | us-south | This policy is required to allow the user to see service instances in the Default resource group. |
IBM Log Analysis service | Resource group | Editor | us-south | This policy is required to allow the user to provision and administer the IBM Log Analysis service in the default resource group. |
The IBM Cloud CLI must be installed. For more information, see Installing the IBM Cloud CLI.
Provision an Windows VPC server instance
If you have an existing Windows virtual server instance you want to monitor, you can skip this step.
-
If you don't have a virtual private cloud, use the IBM Cloud console to create VPC resources.
-
If you don't have a Windows virtual server instance, create an Windows virtual server instance by using the UI and selecting Windows Server as the Operating system.
Provision an IBM Log Analysis instance
To provision an instance of IBM Log Analysis through the IBM Cloud UI, complete the following steps:
-
Log in to your IBM Cloud account.
Click Log in to IBM Cloud to sign in to the IBM Cloud.
After you log in with your user ID and password, the IBM Cloud console opens.
-
Click Catalog. The list of the services that are available in IBM Cloud opens.
-
Select the Logging and Monitoring category.
-
Click the IBM Log Analysis tile.
-
Select a region for the service instance.
-
Select the Lite service plan.
By default, the Lite plan is set.
For more information about other service plans, see Pricing plans.
-
Specify a Service name for your IBM Log Analysis service instance.
-
Select the Default resource group.
By default, the Default resource group is set.
-
To provision the IBM Log Analysis service in the IBM Cloud selected resource group, click Create.
After you provision an instance, the IBM Log Analysis dashboard opens.
To provision an instance of logging through the CLI, see Provisioning logging through the IBM Cloud CLI.
Access your Windows instance
Use a remote desktop client to access your Windows instance. To do so you will need to do the following:
-
Make sure the security group that is associated with the instance allows inbound and outbound Remote Desktop Protocol traffic (TCP port 3389). This is required for the remote desktop client to connect to your Windows instance.
-
Log in to your IBM Cloud account.
Click Log in to IBM Cloud to sign in to the IBM Cloud.
After you log in with your user ID and password, the IBM Cloud console opens.
-
Click the Menu icon > VPC Infrastructure.
-
Click Security groups.
-
Click the security group you used to create your Windows VPC. The Security group details opens.
-
Click Rules.
-
Create an Inbound rule with the following values:
- Protocol = TCP
- Port = Any
- Port min = 3389
- Port max = 3389
- Source type = Any
-
Create an Outbound rule with the following values:
- Protocol = TCP
- Port = Any
- Port min = 3389
- Port max = 3389
- Source type = Any
-
-
Obtain the connection information you need to connect to the Windows VPC.
-
Click Virtual server instances.
-
Click the name of your Windows VPC instance. The instance details are displayed.
-
Under Encrypted password click Download RDP file. A file that can be used with Windows Remote Desktop will be downloaded.
If you are using another client to connect to your Windows VPC, you can still use the information contained in the
RDP
file to get the connection information for the VPC.
-
-
Connect to your Windows VPC using a remote desktop client and the
RDP
file information. Sign in with the User name of.\Administrator
and the decriptedssh
key as the password.
Install NXLog
Follow these steps to install NXLog.
You will need to run as a Windows Administrator for all command prompt or PowerShell steps.
-
The Chocolately package manager is used to install NXLog. Run one of the following if you do not have the package manager already installed.
From a Windows command prompt (
cmd.exe
):powershell -command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"
From a PowerShell prompt:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
-
Run the following command in PowerShell to install NXLog Community Edition.
choco install -y nxlog
Configure NXLog
-
Provision a syslog port for NXLog.
To get the required port value, do the following:
- Access the IBM Log Analysis UI.
- Click the question mark icon to access the installation instructions.
- Click NXLog.
- The syslog port you need to provision in Windows will be displayed. For example,
syslog-a.us-south.logging.cloud.ibm.com:63980
.
Then, in Windows, do the following:
- From the Control Panel access System and Security > Windows Defender Firewall.
- Click Advanced settings.
- Click Inbound Rules.
- Click New Rule.
- Select Port.
- Click Next.
- For Specific local ports: enter
63980
. - Click Next.
- Select Allow the connection.
- Click Next.
- Select where the rule should apply.
- Click Next.
- Name the rule. For example,
syslog-a.us-south.logging.cloud.ibm.com:63980
. - Click Finish.
-
Create your
nxlog.conf
file.-
Get the provided
nxlog.conf
file:- Access the IBM Log Analysis UI.
- Click the question mark icon to access the installation instructions.
- Click NXLog.
- Click Download the file to download a copy of the provided
nxlog.conf
file.
-
Customize the
nxlog.conf
to meet your needs.-
The
<Input eventlog>
section specifies the logging channels to be captured. To enable a logging channel, uncomment the desired lines. To disable a logging channel, comment out those lines. -
LOGFOLDER
specifies the folder to stream logs from. Check that theFile '%LOGFOLDER%\\*.log'
value is correct for your system as well. -
Input, processor, and output channels are connected in the
<Route>
block. Comment out this block to remove the route and disable logging from this channel. Add new input modules with unique names to enable logging from new sources.
-
-
Copy the
nxlog.conf
file as<NXLOGDIR>\conf\nxlog.conf
where<NXLOGDIR>
is the directory where you installed NXLog. For example,C:\Program Files (x86)\nxlog\
-
-
Download the LogDNA SSL Certificate Authority file. This can be done in one of the following ways.
-
Run the following PowerShell script where
<NXLOGDIR>
is the directory where you installed NXLog.$url = "https://assets.us-south.logging.cloud.ibm.com/rootca/ld-root-ca.crt" $output = "<NXLOGDIR>\cert\ca.pem" (New-Object System.Net.WebClient).DownloadFile($url, $output)
-
Use the link in the installation information to download and install the Root CA Certificate.
- Access the IBM Log Analysis UI.
- Click the question mark icon to access the installation instructions.
- Click NXLog.
- Click Download Root CA Certificate to download a copy of the certificate.
- Copy the certificate to
<NXLOGDIR>\cert\ca.pem
, where<NXLOGDIR>
is directory nxlog is installed.
-
Run NXLog
Run the following in PowerShell from the directory where you installed NXLog.
.\nxlog.exe
Run the following in PowerShell from the directory where you installed NXLog to stop the service.
.\nxlog.exe --stop
Launch the logging Web UI
To launch the IBM Log Analysis dashboard from the IBM Cloud UI, complete the following steps:
-
Log in to your IBM Cloud account.
Click IBM Cloud dashboard to launch the IBM Cloud dashboard.
After you log in with your user ID and password, the IBM Cloud Dashboard opens.
-
In the navigation menu, select Observability.
-
Click Logging.
The list of IBM Log Analysis instances that are available on IBM Cloud is displayed.
-
Select one instance. Then, click Open dashboard.
The logging Web UI opens and displays your cluster logs.
View your logs
From the logging Web UI, you can view your logs as they pass through the system. You view logs by using log tailing.
With the Free service plan, you can only tail your latest logs.
Due to Windows limitations, when the Windows VPC instance is created, the hostname is truncated to the first 15 characters of the instance name. The Windows hostname is included as the Hostname
in the IBM Log Analysis log lines.
For example, if you created a Windows VPC named my-cloud-windows-vpc-instance
then the hostname created in Windows Server, and displayed in the logs, will be my-cloud-window
.
You can filter the log lines displayed in IBM Log Analysis by entering queries in the Search...
box.
Search for | Returns |
---|---|
host:<WINDOWS_HOSTNAME> (EventType:INFO OR Severity:INFO) |
All log lines with event type or severity of INFO |
host:<WINDOWS_HOSTNAME> (EventType:warn OR Severity:WARNING) |
All log lines with an event type of warn or severity of WARNING |
host:<WINDOWS_HOSTNAME> Severity:ERROR |
All log lines with a severity of ERROR |
Where <WINDOWS_HOSTNAME>
is the hostname of your Windows VPC server instance.
For more information, see Viewing logs.
Next steps
The following additional features are available:
To use any of these features, you must upgrade the IBM Log Analysis plan to a paid plan.