You can create a metric import task to import on-premises logs to CloudMonitor. After on-premises logs are imported to CloudMonitor, you can create a dashboard to view the monitoring chart of a specified metric.
Prerequisites
A namespace is created. For more information, see the "Create a namespace" section in Manage namespaces.
Background information
After a CloudMonitor agent parses on-premises log data into specific metric values based on your settings, Hybrid Cloud Monitoring reports the metrics to the specified namespace and visualize the related monitoring data in charts.
Create a metric import task
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Click the On-premises Log Monitoring tab.
In the upper-left corner of the On-premises Log Monitoring tab, click Metric Data.
On the On-premises Log Monitoring tab, configure the parameters. The following section describes the parameters.
Parameter
Description
Task Name
The name of the metric import task for on-premises logs.
Description
The description of the metric import task for on-premises logs.
Application Groups
The application group to which the on-premises log data belongs.
Hosts
The rule that is used to match hosts from which on-premises log data is collected. Valid values:
All: collects on-premises log data from all instances.
All Rules: collects on-premises log data from the instances whose names meet all specified conditions.
Any Rule: collects on-premises log data from the instances whose names meet one of the specified conditions.
Log Path
The path where on-premises log data is stored.
Windows: The log path must start with a drive letter. Example: C:\UserData\log\*.Log. You cannot specify wildcard characters in a log path.
Linux: The log path must start with a forward slash (/). Example: /home/appdata/log/**/*.log. In this example, /**/ is used to match all files in the appdata/log/ directory.
Log Encoding
The encoding format of on-premises log data. Only UTF-8 encoding is supported.
Matching Mode
The mode in which on-premises log data is matched. Valid values:
Full Regex Mode
Delimiter Mode
JSON Mode
Sample Log
The sample log that corresponds to the specified match mode.
Regular Expression
The regular expression that is used to match on-premises log data.
This parameter is required only if you set the Matching Mode parameter to Full Regex Mode. You can enter a regular expression or use the regular expression that is automatically generated in the Sample Log section. To obtain a regular expression that is automatically generated, perform the following steps:
In the Sample Log section, enter a sample log.
Click Confirm.
In the Sample Log section, select the field that you want to parse and click Generate Regular Expression.
Log Extraction Results
The extraction result of on-premises log data.
CloudMonitor extracts fields from on-premises logs based on Sample Log.
Collection Cycle
The interval at which on-premises log data is collected. Valid values: 10s, 20s, 30s, 1m, 2m, and 5m.
Metric Settings
The statistical method that is used to analyze on-premises log data based on a specific metric.
Specify a statistical method for a metric based on the valid fields that are parsed in the Sample Log section.
Namespace
The name of the namespace.
Tags
The tags of the metric. You can specify tag keys and tag values based on your business requirements.
Agent Installation Confirmation
Make sure that a CloudMonitor agent V3.5.5 or later is installed on the instances of the selected application group. For more information about how to install a CloudMonitor agent, see Install and uninstall the CloudMonitor agent for C++.
Click OK.
Modify a metric import task
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Click the On-premises Log Monitoring tab.
Find the metric import task that you want to modify and click Modify in the Actions column.
On the On-premises Log Monitoring tab, configure the parameters. The following section describes the parameters.
Parameter
Description
Task Name
The name of the metric import task for on-premises logs.
Description
The description of the metric import task for on-premises logs.
Hosts
The rule that is used to match hosts from which on-premises log data is collected. Valid values:
All: collects on-premises log data from all instances.
All Rules: collects on-premises log data from the instances whose names meet all specified conditions.
Any Rule: collects on-premises log data from the instances whose names meet one of the specified conditions.
Log Path
On-premises log data is stored in the specified path of the host where CloudMonitor is deployed.
Windows: The log path must start with a drive letter. Example: C:\UserData\log\*. Log. You cannot specify wildcard characters in a log path.
Linux: The log path must start with a forward slash (/). Example: /home/appdata/log/**/*.log. In this example, /**/ is used to match all files in the appdata directory.
Log Encoding
The encoding format of on-premises log data. Only UTF-8 encoding is supported.
Matching Mode
The mode in which on-premises log data is matched. Valid values:
Full Regex Mode
Delimiter Mode
JSON Mode
Sample Log
The sample log that corresponds to the specified match mode.
Regular Expression
The regular expression that is used to match on-premises log data.
This parameter is required only if you set the Matching Mode parameter to Full Regex Mode. You can enter a regular expression or use the regular expression that is automatically generated in the Sample Log section. To obtain a regular expression that is automatically generated, perform the following steps:
In the Sample Log section, enter a sample log.
Click Confirm.
In the Sample Log section, select the field that you want to parse and click Generate Regular Expression.
Log Extraction Results
The extraction result of on-premises log data.
CloudMonitor extracts fields from on-premises logs based on Sample Log.
Collection Cycle
The interval at which on-premises log data is collected. Valid values: 10s, 20s, 30s, 1m, 2m, and 5m.
Metric Settings
The statistical method that is used to analyze on-premises log data based on a specific metric.
Specify a statistical method for a metric based on the valid fields that are parsed in the Sample Log section.
Tags
The tags of the metric. You can specify tag keys and tag values based on your business requirements.
Agent Installation Confirmation
Make sure that a CloudMonitor agent V3.5.5 or later is installed on the instances of the selected application group. For more information about how to install a CloudMonitor agent, see Install and uninstall the CloudMonitor agent for C++.
Click OK.
Delete a metric import task
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Click the On-premises Log Monitoring tab.
Find the metric import task that you want to delete and click Delete in the Actions column.
In the Confirm deletion message, click Confirm.
Copy a metric import task
Log on to the CloudMonitor console.
In the left-side navigation pane, choose .
Click the On-premises Log Monitoring tab.
Find the metric import task that you want to copy and click Copy in the Actions column.
On the On-premises Log Monitoring tab, configure the parameters. The following section describes the parameters.
By default, CloudMonitor runs the current metric import task based on the values that you specified for all parameters. You can modify the settings based on your business requirements.