The Add Log Pattern Monitor screen allows users to create a new custom log pattern monitor by defining log source details, search patterns, metrics, and advanced settings. Once configured, the monitor can be deployed to the required tiers and servers using the Deployment UI.

The log pattern monitor helps you to visualize log data by configuring patterns and helps you analyze massive log data for quick and easy issue identification.

## Add Log Pattern Monitor

- Metric Group Name: Enter a unique name for the metric group. This name is used to identify the log pattern monitor across configuration and deployment screens and the metrics captured from the log pattern are displayed under this metric group name.
- Metric Group Description: Provide a brief description of the metric group to explain the purpose of the log pattern monitor.
- File Name Selection: This section allows users to specify how the log source should be identified for applying the Log Pattern Monitor. Based
  - File Name: Enter the name or full path of the log file on which the Log Pattern Monitor should be applied. Example: /var/log/application/app.log
  - Use Command to Get File Name:Use this option to provide a command that dynamically extracts the log file name on which the monitor is deployed. This is useful when log file names change or are generated at runtime.
    - Example: ls -t /var/log/application/*.log | head -1
  - Use JournalD: Select this option to collect logs from JournalD.Users can choose:
    - All: Select this option to scan and collect logs from all available JournalD sources on the system.
    - Specified : When the Specified option is selected, users can define a specific JournalD source or pattern. If a regular expression is provided, by default only the latest matching JournalD log is read. To scan all matching logs, users must enable the Read multiple log file option available under Advanced Settings in the Log Pattern Monitor configuration.

## Metrics Table

This table displays all the metrics configured for the log pattern monitor.

- Search Pattern: Specifies the text, keyword, or regular expression that is searched within the log file. For example, a text pattern like Connection failed matches the exact phrase in the logs, a keyword such as ERROR matches any log entry containing that word, and a regular expression like ERROR|WARN matches log lines that contain either ERROR or WARN.
- Metric Name: Defines the name of the metric generated when the corresponding search pattern is detected. This metric is captured under the Metric Group Name defined above and is visible under the aforementioned group in the metric tree.
- Unit: Indicates the unit in which the metric is calculated, such as Per Sec or Per Min which basically detects the count of the instance that were matched with the search pattern given by the user.

Note: For each pattern, two metrics are configured: a rate-based metric (Per Sec or Per Min) and a Cumulative metric. The cumulative metric tracks the total number of pattern occurrences since the monitor started and is reset each time the monitor restarts.

## Global Action Icons (Metrics)

Add (+): Opens the Add Metrics dialog, where users can define a new metric by providing the Search Pattern, Metric Name, and Unit (Per Sec or Per Min). Users can click Save to add the metric or Cancel to discard the changes.

- Edit: Allows users to modify the selected metric details.
- Delete: Removes the selected metric from the list after confirmation.
- Manage Columns: Allows users to show or hide columns in the Metrics table to customize the view.

## Advanced Settings

- Dump Server Logs inside the Test Run: Enable this option to capture and store server logs within the test run for analyzing any errors or anomalies detected during the test run with the help of the collected logs. .
- Read Multiple Log Files: For reading multiple log files, specify a regular expression (such as *, ?, [ ], ( )) in the file path. When this option is enabled, all log files matching the defined pattern are read and monitored instead of only the latest modified file.

Notes:

- If a file name contains a regular expression, only the latest modified file is read by default.
- To read all matching files, enable Read multiple log files.
- For multiple log files, special characters supported in file paths include * ? [ ] { } ( ) +. At the file level, only * is supported.

## Actions

- Save: Saves the Log Pattern Monitor configuration without deploying it. The monitor is stored and can be deployed later.
- Save and Deploy: Saves the configuration and immediately deploys the monitor to the selected tier and server, starting log monitoring without any additional steps.
- Cancel: Discards the configuration and exits the screen without saving any changes.