# Viewing Log Files

You can quickly view log files of service instances or hosts to locate faults.

#### Precautions

The time information contained in a log file, if any, is automatically displayed, as shown in the red box in Figure 1. This time information is irrelevant to the time range that you set.

Figure 1 Viewing a log file

#### Viewing Service Log Files

You can quickly view log files of service instances to locate faults.

1. Log in to the management console.
2. Under Application, click Application Operations Management.
3. In the navigation pane, choose Log Management > Log Files.
4. Click the Service tab.
5. On the displayed page, select a target cluster and namespace from the drop-down lists.
6. Choose whether to enable Hide System Service.
7. Enter a service name keyword and click to search services.
8. On the left of the Log Files page, click a service name. Information such as log file names and last written time is displayed.
9. Click View in the Operation column of a desired log file, and view log file details by performing the operations described in Table 1, as shown in Figure 3.

   Table 1 Operations
   Operation | Setup | Description
   --- | --- | ---

   Entering a keyword

   None

   Enter a keyword in the search box in the upper right corner. Rules are as follows:
   - Enter a case-sensitive keyword.
   - Enter a keyword for exact search. A keyword refers to a word between two adjacent delimiters.
   - Enter a keyword containing an asterisk (*) or a question mark (?) for fuzzy search. For example, enter ER?OR, *ROR, or ER*R.
   - Enter a phrase for exact search. For example, enter Start to refresh or Start-to-refresh. Note that hyphens (-) are delimiters.
   - Enter a keyword containing AND (&&) or OR (||) for search. For example, enter query logs&&error* or query logs||error.

   Setting a time range | Date and time | Click to select the date and time.
   Time range | Select a specific time range on the time axis to view logs. You can select only one range (5 minutes) each time. Scroll the mouse to increase or decrease the time granularity.
   Viewing log files | Clear | Click Clear to clear the logs displayed on the screen. This operation clears only the logs displayed on the screen but does not delete them.

   Viewing real-time logs

   The function of real-time monitoring is disabled by default. To enable it, click Enable Real-Time Viewing. After this function is enabled, the latest written logs can be viewed.

   The exception in the log records the exceptions that occur during code running. When using logs to locate faults, pay attention to the exception. For real-time log viewing, AOM automatically highlights exception keywords in logs, facilitating fault locating. Such keywords are case-sensitive. For example, exception and Exception are highlighted, but keywords such as EXCEPTION, exCeption, and EXception are not highlighted, as shown in the following figure.

   Figure 2 Viewing real-time logs
   NOTE:

   After the function of viewing logs in real time is enabled, AOM automatically highlights exception keywords in logs. In that case, you cannot enter keywords to search for logs.

   Maximized display | Click to maximize a page. Components like the time axis are invisible on the screen. Click again to cancel the maximized display.

   Figure 3 Log file details

#### Viewing Host Log Files

AOM enables you to quickly view log files of hosts, facilitating fault locating.

1. Log in to the management console.
2. Under Application, click Application Operations Management.
3. In the navigation pane, choose Log Management > Log Files.
4. Click the Host tab.
5. On the displayed page, select a target cluster from the drop-down list.
6. Enter a host IP address keyword and click to search.
7. On the left of the Log Files page, click a host IP address. Information such as log file names and last written time is displayed.
8. Click View in the Operation column of a desired log file, and perform operations based on Table 2 to view log file details, as shown in Figure 5.

   Table 2 Operations
   Operation | Setup | Description
   --- | --- | ---

   Entering a keyword

   None

   Enter a keyword in the search box in the upper right corner. Rules are as follows:
   - Enter a case-sensitive keyword.
   - Enter a keyword for exact search. A keyword refers to a word between two adjacent delimiters.
   - Enter a keyword containing an asterisk (*) or a question mark (?) for fuzzy search. For example, enter ER?OR, *ROR, or ER*R.
   - Enter a phrase for exact search. For example, enter Start to refresh or Start-to-refresh. Note that hyphens (-) are delimiters.
   - Enter a keyword containing AND (&&) or OR (||) for search. For example, enter query logs&&error* or query logs||error.

   Setting a time range | Date and time | Click to select the date and time.
   Time range | Select a specific time range on the time axis to view logs. You can select only one range (5 minutes) each time. Scroll the mouse to increase or decrease the time granularity.
   Viewing log files | Clear | Click Clear to clear the logs displayed on the screen. This operation clears only the logs displayed on the screen but does not delete them.

   Viewing real-time logs

   The function of real-time monitoring is disabled by default. To enable it, click Enable Real-Time Viewing. After this function is enabled, the latest written logs can be viewed.

   The exception in the log records the exceptions that occur during code running. When using logs to locate faults, pay attention to the exception. For real-time log viewing, AOM automatically highlights exception keywords in logs, facilitating fault locating. Such keywords are case-sensitive. For example, exception and Exception are highlighted, but keywords such as EXCEPTION, exCeption, and EXception are not highlighted, as shown in the following figure.

   Figure 4 Viewing real-time logs
   NOTE:

   After the function of viewing logs in real time is enabled, AOM automatically highlights exception keywords in logs. In that case, you cannot enter keywords to search for logs.

   Maximized display | Click to maximize a page. Components like the time axis are invisible on the screen. Click again to cancel the maximized display.

   Figure 5 Log file details

Parent topic: Log Management