Configure console embed parameters to customize the appearance of Log Service pages embedded in your website.
Simple Log Service supports login-free embedding of its console pages into your website for quick log query and analysis. It also provides UI parameters to integrate the embedded pages with your website. For detailed instructions on embedding pages in login-free mode, see Embed console pages and share log data.
Notes
The Log Service console is embedded in an iframe. By default, browser security policies block features such as opening new windows and downloading logs. To enable these features, configure the iframe's sandbox attribute.
-
Browser security policies block links within the iframe from opening pop-ups. To allow pop-ups, add
allow-popupsto the iframe's sandbox attribute.<iframe src="https://sls4service.console.alibabacloud.com/lognext/project/**..." sandbox="allow-scripts allow-popups" /> -
These policies also block log downloads. To allow downloads, add both
allow-popupsandallow-downloadsto the iframe's sandbox attribute.<iframe src="https://sls4service.console.alibabacloud.com/lognext/project/**..." sandbox="allow-scripts allow-popups allow-downloads" />
URL format
All UI parameters are specified in the URL in the following format:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?parameter1¶meter2
-
Place all parameters except ${ProjectName}, ${LogstoreName}, ${savedsearchID}, and ${dashboardID} after the question mark (?) at the end of the URL.
-
Use an ampersand (&) to separate multiple parameters.
-
To use the dark theme, add theme=dark&sls_iframe=true to the URL.
-
The following URL parameters are case-sensitive.
Common parameters
Use common parameters to configure the console.
|
Parameter |
Type |
Required |
Description |
Example |
|
hiddenBack |
boolean |
No |
Hides the back button on the console for the current project. |
hiddenBack=true |
|
hiddenChangeProject |
boolean |
No |
Hides the project switching control. |
hiddenChangeProject=true |
|
hiddenOverview |
boolean |
No |
Hides the entry point for project overview. |
hiddenOverview=true |
|
hideSidebar |
boolean |
No |
Hides the navigation pane on the left. |
hideSidebar=true |
|
hideTopbar |
boolean |
No |
Hides the top navigation bar. |
hideTopbar=true |
|
isShare |
boolean |
No |
Hides the navigation pane on the left and other tabs. |
isShare=true |
|
ignoreTabLocalStorage |
boolean |
No |
Disables tab browsing history. |
ignoreTabLocalStorage=true |
|
queryTimeType |
long |
No |
The time range for query and analysis. For more information, see queryTimeType values.
|
queryTimeType=1 |
|
startTime |
timestamp |
No |
The start time of the query time range. Takes effect only when queryTimeType is set to 99. |
startTime=1547776643 |
|
endTime |
timestamp |
No |
The end time of the query time range. Takes effect only when queryTimeType is set to 99. |
endTime=1547776731 |
|
disablePublicShare |
boolean |
No |
Hides the Create Password-free Share button on a dashboard. |
disablePublicShare=true |
Table 1. queryTimeType values
|
queryTimeType |
Description |
|
1 |
1 minute (relative) |
|
2 |
15 minutes (relative) |
|
3 |
1 hour (relative) |
|
4 |
4 hours (relative) |
|
5 |
1 day (relative) |
|
6 |
1 week (relative) |
|
7 |
30 days (relative) |
|
8 |
1 minute (time frame) |
|
9 |
15 minutes (time frame) |
|
10 |
1 hour (time frame) |
|
11 |
4 hours (time frame) |
|
12 |
1 day (time frame) |
|
13 |
1 week (time frame) |
|
14 |
30 days (time frame) |
|
15 |
Today (time frame) |
|
16 |
Yesterday (time frame) |
|
17 |
The day before yesterday (time frame) |
|
18 |
This week (time frame) |
|
19 |
Last week (time frame) |
|
20 |
This month (time frame) |
|
21 |
This quarter (time frame) |
|
22 |
Today (relative) |
|
23 |
5 minutes (relative) |
|
24 |
This year (time frame) |
|
25 |
This month (relative) |
|
26 |
Last month (time frame) |
|
27 |
This week (relative) |
|
28 |
5 minutes (time frame) |
|
29 |
Yesterday (relative) |
|
30 |
The day before yesterday (relative) |
|
31 |
Last week (relative) |
|
32 |
Last month (relative) |
|
33 |
This quarter (relative) |
|
34 |
This year (relative) |
|
99 |
A custom time range. Requires the |
The following examples show how to use URL parameters:
-
To hide the back button, the project switching control, and the project overview entry point, use the following URL:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?hiddenBack=true&hiddenChangeProject=true&hiddenOverview=true -
To hide the back button, use the following URL:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?hiddenBack=true -
To set the time range for query and analysis, use the following URL:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?queryTimeType=3When
queryTimeTypeis set to3, the time range picker in the upper-right corner of the query page displays 1 hour (relative).
Logstore query and analysis page parameters
Use the following parameters to configure the query and analysis page of a Logstore.
|
Parameter |
Type |
Required |
Description |
Example |
|
ProjectName |
string |
Yes |
The name of the project. |
website-01 |
|
LogstoreName |
string |
Yes |
The name of the Logstore. |
logstore01 |
|
queryString |
string |
No |
A Base64-encoded query statement. For example, the query statement |
KnxzZWxlY3QgY291bnQoKik= |
|
readOnly |
boolean |
No |
Hides editable UI elements, such as Share, Index Attributes, Save as Saved Search, and Save as Alert. |
readOnly=true |
|
encode |
string |
No |
To avoid special characters in the queryString, use |
encode=base64 |
|
hiddenEtl |
boolean |
No |
Hides the data transformation button. |
hiddenEtl=true |
|
hiddenShare |
boolean |
No |
Hides the Share button. |
hiddenShare=true |
|
hiddenIndexSetting |
boolean |
No |
Hides the index configuration button. |
hiddenIndexSetting=true |
|
hiddenSavedSearch |
boolean |
No |
Hides the saved search button. |
hiddenSavedSearch=true |
|
hiddenAlert |
boolean |
No |
Hides the alert button. |
hiddenAlert=true |
|
hiddenQuickAnalysis |
boolean |
No |
Collapses the Quick Analysis pane by default. |
hiddenQuickAnalysis=true |
|
hiddenDownload |
boolean |
No |
Hides the log download feature. |
hiddenDownload=true |
|
hiddenModeSwitch |
boolean |
No |
Hides the Dedicated SQL button. |
hiddenModeSwitch=true |
|
keyDispalyMode |
string |
No |
The display mode for the content column.
|
keyDispalyMode=single |
|
hiddenLogChart |
boolean |
No |
Hides the Graph tab. |
hiddenLogChart=true |
|
hiddenLogReduce |
boolean |
No |
Hides the LogReduce tab. |
hiddenLogReduce=true |
|
hiddenColSetting |
boolean |
No |
Hides the left-side fields column. |
hiddenColSetting=true |
|
hiddenLogInspection |
boolean |
No |
Hides the Intelligent Health Check tab. |
hiddenLogInspection=true |
The following examples show how to use URL parameters:
-
Use the following URL to specify a query statement.
For example, the query statement
*|select count(*)is encoded in Base64 asKnxzZWxlY3QgY291bnQoKik=.https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?encode=base64&queryString=KnxzZWxlY3QgY291bnQoKik= -
Use the following URL to hide editable UI elements, such as Index Attributes and Save as Alert.
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?readOnly=true -
Use the following URL to hide the Graph and LogReduce tabs.
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?hiddenLogChart=true&hiddenLogReduce=trueWith these tabs hidden, the query and analysis page displays only the raw logs tab.
LogStore saved search parameters
Use the following parameters to customize a LogStore saved search page.
|
Parameter |
Type |
Required |
Description |
Example |
|
ProjectName |
string |
Yes |
The Project name. |
website-01 |
|
savedSearchName |
string |
No |
The name of the saved search. |
quick-search01 |
|
savedsearchID |
string |
Yes |
The ID of the saved search. Note
After you create a saved search, you can get its ID from the URL. For more information, see Get a saved search ID. |
savedsearch-1621845672511-314813 |
The following example shows the URL format:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/savedsearch/${savedsearchID}
This URL opens the saved search page for the specified saved search, such as quick-search01, in the corresponding project, such as website-01. The page displays the saved query statement, such as *|select count(*), and provides operations including data transformation, query and analysis properties, save as alert, and modify a saved search.
Dashboard parameters
Use the following parameters to customize a dashboard.
|
Parameter |
Type |
Required |
Description |
Example |
|
ProjectName |
string |
Yes |
The name of the project. |
website-01 |
|
dashboardName |
string |
No |
The name of the dashboard. |
Website Analysis Logs |
|
dashboardID |
string |
Yes |
The ID of the dashboard. Note
After you create a dashboard, you can obtain its ID from the URL. For more information, see ListDashboard. |
dashboard-1609817292009-742588 |
|
isShare |
boolean |
No |
Whether the dashboard is viewed via a share link. If set to |
isShare=true |
|
token |
JsonString |
No |
The token for variable replacement. The value must be URL-encoded with the For example, |
token=%5B%7B%22key%22%3A%20%22projectname%22%2C%22value%22%3A%221%22%7D%2C%20%7B%22key%22%3A%20%22region%22%2C%20%22value%22%3A%20%22hangzhou%22%7D%5D |
|
readOnly |
boolean |
No |
Whether to enable read-only mode. If set to |
readOnly=true |
|
openPsql |
boolean |
No |
Whether to enable the **Dedicated SQL** feature. |
openPsql=true |
|
autoFresh |
string |
No |
The auto-refresh interval for the dashboard, for example, |
autoFresh=5m |
|
filters |
string |
No |
The filter conditions to apply. The value must be URL-encoded with the For example, |
filters=key1%3Avalue1%26filters%3Dkey2%3Avalue2 |
|
hiddenFilter |
boolean |
No |
Hides the **Filter Conditions** section. |
hiddenFilter=true |
|
fixedFilter |
boolean |
No |
Prevents the modification or deletion of filter conditions. |
fixedFilter=true |
|
disableFilterAndToken |
boolean |
No |
Disables filter conditions and variable replacement. |
disableFilterAndToken=true |
|
fixedToken |
boolean |
No |
Prevents the modification or deletion of variable replacement settings. |
fixedToken=true |
|
hiddenToken |
boolean |
No |
Hides the **Variable Replacement** section. |
hiddenToken=true |
|
hiddenProject |
boolean |
No |
Hides project information. |
hiddenProject=true |
|
hiddenEdit |
boolean |
No |
Hides the **Edit** button. |
hiddenEdit=true |
|
hiddenReport |
boolean |
No |
Hides the **Subscribe** button. |
hiddenReport=true |
|
hiddenTitleSetting |
boolean |
No |
Hides the **Title Setting** button. |
hiddenTitleSetting=true |
|
hiddenReset |
boolean |
No |
Hides the **Reset Time** button. |
hiddenReset=true |
|
hiddenModeSwitch |
boolean |
No |
Hides the **Dedicated SQL** button. |
hiddenModeSwitch=true |
|
hiddenAlert |
boolean |
No |
Hides the **Save as Alert** option. |
hiddenAlert=true |
|
hiddenSearch |
boolean |
No |
Hides the **Preview Query** option. |
hiddenSearch=true |
|
hiddenShare |
boolean |
No |
Hides the **Share** button in the top bar. This button includes the Share Link and Send Dashboard options. |
hiddenShare=true |
|
hiddenPSql |
boolean |
No |
Hides the **Dedicated SQL** button. |
hiddenPSql=true |
|
hiddenFullScreen |
boolean |
No |
Hides the full-screen options (Monitor Full Screen and Window Full Screen) in the top bar. |
hiddenFullScreen=true |
|
hiddenSelectTime |
boolean |
No |
Hides the **Time Range** selector in the top bar. |
hiddenSelectTime=true |
|
hiddenChartTime |
boolean |
No |
Hides the time range display for individual charts, which appears after the chart title. |
hiddenChartTime=true |
|
hiddenChartMenus |
boolean |
No |
Hides the drop-down menu in the upper-right corner of each chart. |
hiddenChartMenus=true |
|
hiddenTitle |
boolean |
No |
Hides the dashboard title. |
hiddenTitle=true |
|
hiddenTopBar |
boolean |
No |
Hides the top bar of the dashboard, which includes the title and all action buttons. |
hiddenTopBar=true |
|
hiddenCopy |
boolean |
No |
Hides the **Save as** button. |
hiddenCopy=true |
|
hiddenSurvey |
boolean |
No |
Hides the survey entry point. |
hiddenSurvey=true |
|
hiddenDrilldown |
boolean |
No |
Hides the **Drill-down** tab in the dashboard's edit mode. |
hiddenDrilldown=true |
|
hiddenFieldConfig |
boolean |
No |
Hides the **Field Configuration** tab in the dashboard's edit mode. |
hiddenFieldConfig=true |
|
disableViewChart |
boolean |
No |
Hides the **View** option for individual charts. |
disableViewChart=true |
The following examples show how to use URL parameters:
-
To enable read-only mode for a dashboard, use the following URL:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/dashboard/${dashboardID}?readOnly=trueIn read-only mode, the dashboard's top toolbar displays only view-related buttons such as Time Range, Refresh, Reset Time, Share, Full Screen, and Subscribe. Editing features are unavailable.
-
To add two filter conditions,
key1:value1andkey2:value2, to a dashboard, use the following URL. The filter condition stringfilters=key1:value1&filters=key2:value2is encoded tofilters%3Dkey1%3Avalue1%26filters%3Dkey2%3Avalue2.https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/dashboard/${dashboardID}?filters%3Dkey1%3Avalue1%26filters%3Dkey2%3Avalue2After you set the filter conditions, the dashboard displays data that is filtered by
key1:value1` and `key2:value2. -
To add multiple variable replacement conditions, such as
projectname=1` and `region=hangzhou, use the following URL. In this example,token=[{"key": "projectname","value":"1"}, {"key": "region", "value": "hangzhou"}]is encoded totoken=%5B%7B%22key%22%3A%20%22projectname%22%2C%22value%22%3A%221%22%7D%2C%20%7B%22key%22%3A%20%22region%22%2C%20%22value%22%3A%20%22hangzhou%22%7D%5D.https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/dashboard/${dashboardID}?token=%5B%7B%22key%22%3A%20%22projectname%22%2C%22value%22%3A%221%22%7D%2C%20%7B%22key%22%3A%20%22region%22%2C%20%22value%22%3A%20%22hangzhou%22%7D%5D -
To auto-refresh the dashboard every 5 minutes, use the following URL:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/dashboard/${dashboardID}?autoFresh=5m
Tree structure parameters
Tree structure parameters configure the left-side navigation pane of the console.
|
Parameter |
Type |
Required |
Description |
Example |
|
treeConfig |
JSON |
No |
Defines the tree structure of the left-side navigation pane. If you set the treeEncode parameter to base64, the value of this parameter must be Base64-encoded. For example, |
eyJsb2dzdG9yZSI6eyJleHBhbmQiOnRydWUsInJlc291cmNlTGlzdCI6WyJkZWxldGUtbG9nIl0sInRlbXBsYXRlIjpbInNhdmVkc2VhcmNoIiwiYWxlcnQiXX19 |
|
treeEncode |
string |
No |
The encoding format for the treeConfig parameter. The default value is an empty string, which indicates no encoding. The only supported encoding is Base64. |
treeEncode=base64 |
The following is a complete example of the treeConfig parameter:
{
"logstore": {
"search": true,
"expand": true,
"resourceList": [
"L1",
"L2"
],
"template": [
"favor",
"logtail",
"import",
"etl",
"savedsearch",
"alert",
"export",
"consumergroup",
"dashboard"
]
},
"machineGroup": {
"search": true,
"resourceList": [
"m1",
"m2"
]
},
"savedSearch": {
"search": true,
"resourceList": [
"s1",
"s2"
]
},
"alarm": {
"search": true,
"resourceList": [
"a1",
"a2"
]
},
"dashboard": {
"search": true,
"resourceList": [
"d1",
"d2"
]
},
"etl": {
"search": true,
"resourceList": [
"e1",
"e2"
]
}
}
Table 2. treeConfig parameters
|
Parameter |
Type |
Required |
Description |
|
logstore |
object |
No |
Controls the resource entries in the Logstore list. |
|
template |
string[] |
No |
Controls the feature entries in the Logstore list. For more information, see |
|
machineGroup |
object |
No |
Controls the resource entries in the machine group list. |
|
savedSearch |
object |
No |
Controls the resource entries in the saved search list. |
|
alert |
object |
No |
Controls the resource entries in the alert list. |
|
dashboard |
object |
No |
Controls the resource entries in the dashboard list. |
|
etl |
object |
No |
Controls the resource entries in the data transformation list. |
Table 3. Resource-related parameters
|
Parameter |
Type |
Required |
Description |
|
search |
boolean |
No |
Whether to display the search box. Default value: |
|
resourceList |
String[] |
No |
The list of resources to display. Only resources whose names exactly match an entry in this array are shown. If not configured, all resources of the corresponding type are displayed. |
|
expand |
boolean |
No |
Whether to expand the resource list. Default value: |
Table 4. template parameters
|
Parameter |
Type |
Required |
Description |
|
favor |
string |
No |
watchlist |
|
logtail |
string |
No |
Logtail configuration |
|
import |
string |
No |
data import |
|
etl |
string |
No |
data transformation |
|
savedsearch |
string |
No |
saved search |
|
alert |
string |
No |
alert |
|
export |
string |
No |
data export |
|
consumergroup |
string |
No |
data consumption |
|
dashboard |
string |
No |
dashboard |
Use the following URL to configure the left-side navigation pane:
https://sls4service.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?treeconfig=eyJsb2dzdG9yZSI6eyJleHBhbmQiOnRydWUsInJlc291cmNlTGlzdCI6WyJkZWxldGUtbG9nIl0sInRlbXBsYXRlIjpbInNhdmVkc2VhcmNoIiwiYWxlcnQiXX19&hiddenBack=true&hiddenChangeProject=true&hiddenOverview=true&treeEncode=base64&ignoreTabLocalStorage=true
After you apply this configuration, the left-side navigation pane displays the Logstore delete-log under the project website-01. The Logstore is expanded to show two sub-features: saved search and alert.
Advanced dashboard parameters
When a dashboard is embedded in an iframe, the iframe height is not set automatically, which can create two scroll bars: one for the parent page and one for the dashboard. Use advanced parameters to make the dashboard height adjust dynamically.
You can retrieve the iframe height from the dashboardHeight property, which Simple Log Service passes in a postmessage event. Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>POST message test</title>
</head>
<style>
* {
padding: 0;
margin: 0;
}
iframe {
display: block;
width: 100%;
}
</style>
<body>
<script>
window.addEventListener('message',function(e){
console.log(e.data.dashboardHeight)
document.getElementById('test').style.height = e.data.dashboardHeight + 'px'
});
</script>
<div style="height: 700px;">somethings</div>
<iframe id="test" src="http://sls4service.console.alibabacloud.com/lognext/project/${projectName}/dashboard/${dashboardName}?product=${productCode}">
</body>
</html>