After indexes are configured, you can query and analyze the logs that are collected on the query and analysis page in real time.
- Log on to the Log Service console.
- In the Projects section, click the name of the project that you want to view.
- Choose . On the Logstores tab, click the Logstore that you want to view.
- Enter a query statement in the input field.
- Click 15 Minutes(Relative) to specify the time range for the query statement. You can select a relative time, select a time frame, or customize a time range. However, the time range that you can specify is only accurate to the minute at most. If you want to use a time range that is accurate to the second, you must specify the time range in the analytic statement. Example:
* | SELECT * FROM log WHERE __time__>1558013658 AND __time__< 1558013660.Note The query and analysis results may contain logs that are generated 1 minute earlier or later than the specified time range.
- Click Search & Analyze to view the query and analysis results.
Manage query and analysis results
- Log distribution histogram
The log distribution histogram shows the distribution of returned logs in different periods of time.
- When you move the pointer over a green rectangle, you can view the period of time that is represented by the rectangle and the number of returned logs within the period.
- If you click a green rectangle, you can view log distribution at a finer-grained level. In addition, you can view the returned logs within the period of time on the Raw Logs tab.
- Raw Logs tab
The Raw Logs tab displays the logs that are queried. You can click the Table or Raw Data tab to view the logs and perform the following operations:
- Quick Analysis: You can analyze the distribution of a field within a period of time.
For more information, see Quick analysis.
You can click the icon to specify whether to show the names or aliases of fields. You can create aliases when you configure indexes. For example, if the alias of host_name is host, host is displayed in the Quick Analysis list after you select Show Field Aliases.Note If a field does not have an alias, the name of the field is displayed in the Quick Analysis list even if you select Show Field Aliases.
- Context query: On the Raw Data tab, you can find a log and click the icon to query the context information about the log in the raw log file. For more
information, see Context query.
Note You can perform context query only on the logs that are collected by Logtail.
- LiveTail: On the Raw Data tab, you can find a log and click the icon to monitor logs in real time and extract important information from the logs.
For more information, see LiveTail.
Note You can use LiveTail only on the logs that are collected by Logtail.
- Tag Configurations: On the Raw Data tab, you can click the icon and select Tag Configurations to hide less important fields.
- Column Settings: On the Table tab, you can click the icon and select Column Settings to specify the columns that you want to display in the table. The column names are field names, and the column content is field values.
- JSON Configurations: On the Table or Raw Data tab, you can click the icon and select JSON Configurations to specify the level for JSON expansion.
- Event Settings: On the Table or Raw Data tab, you can click the icon and select Event Settings to configure events for raw logs. For more information, see Configure events.
- Log Download: On the Table or Raw Data tab, you can click the icon to download logs. You can specify the tool that is used to download logs and the range of logs to download. For more information, see Download logs.
- Quick Analysis: You can analyze the distribution of a field within a period of time. For more information, see Quick analysis.
- Graph tab
After you execute a query statement, you can view the query and analysis results on the Graph tab.
- View query and analysis results: Log Service renders the results of the query statement to charts. Log Service provides various types of charts, such as tables, line charts, and column charts. For more information, see Chart overview.
- Add a chart to a dashboard: Log Service provides dashboards on which you can analyze data in real time. You can click Add to New Dashboard to save the query and analysis results as a chart to a dashboard. For more information, see Visualization overview.
- Configure interactive events: Interactive events are important for data analysis. You can use interactive events to switch between the levels of data dimensions and the analysis granularities to obtain more detailed information. Interactive events include events to open a Logstore, open quick analysis, open a dashboard, open trace analysis, open trace details, and customize an HTTP link. For more information, see Configure a drill-down event.
- LogReduce tab
On the LogReduce tab, you can click Enable LogReduce to cluster similar logs during log collection. For more information, see LogReduce.
On the query and analysis page, you can choose Configure an alert in Log Service.to configure alerts based on the query and analysis results. For more information, see
- Saved search
On the query and analysis page, you can click Save Search to save a query statement as a saved search. For more information, see Saved search.