Console embed parameters
In the Log Service console, configure embed parameters to customize the appearance of the embedded page.
Simple Log Service supports login-free embedding of its pages into your own website, allowing for quick and convenient log query and analysis. It also provides UI parameters to seamlessly integrate the embedded pages with your own website. For detailed instructions on embedding pages in login-free mode, see Embed console pages and share log data.
Notes
When the Log Service console is embedded in an iframe, default browser security policies block features like opening new windows and downloading logs. To enable these features, you must 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://sls4servims.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://sls4servims.console.alibabacloud.com/lognext/project/**..." sandbox="allow-scripts allow-popups allow-downloads" />
URL format
All UI parameters are controlled through the URL, which has the following format:
https://sls4servims.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 |
Specifies the time range for query and analysis. For more information, see queryTimeType values.
|
queryTimeType=1 |
|
startTime |
timestamp |
No |
Specifies the start time of the query time range. This parameter takes effect when queryTimeType is set to 99. |
startTime=1547776643 |
|
endTime |
timestamp |
No |
Specifies the end time of the query time range. This parameter is valid 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 demonstrate how to use URL parameters:
-
To hide the back button, the Project switching control, and the Project Overview entry point, use this URL:
https://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?hiddenBack=true&hiddenChangeProject=true&hiddenOverview=true -
To hide the back button, use this URL:
https://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?hiddenBack=true -
To set the time range for query and analysis, use this URL:
https://sls4servims.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, we recommend that you 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 |
The following examples show how to use URL parameters and their effects:
-
Use the following URL to specify a query statement.
For example, the query statement
*|select count(*)is encoded in Base64 asKnxzZWxlY3QgY291bnQoKik=.https://sls4servims.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://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?readOnly=true -
Use the following URL to hide the Graph and LogReduce tabs.
https://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/logsearch/${LogstoreName}?hiddenLogChart=true&hiddenLogReduce=trueWhen these tabs are 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 and the resulting page:
https://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/savedsearch/${savedsearchID}
When you access this URL, the page for the specified saved search, such as quick-search01, opens in the corresponding Project, such as website-01. It 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 dashboard parameters to customize the 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 |
Specifies whether the dashboard is viewed via a share link. If set to |
isShare=true |
|
token |
JsonString |
No |
Specifies the token for variable replacement. The value must be URL-encoded by using 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 |
Specifies whether to enable read-only mode. If set to |
readOnly=true |
|
openPsql |
boolean |
No |
Specifies whether to enable the **Dedicated SQL** feature. |
openPsql=true |
|
autoFresh |
string |
No |
The interval at which the dashboard automatically refreshes. Examples: |
autoFresh=5m |
|
filters |
string |
No |
The filter conditions to apply. The value must be URL-encoded by using 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 and their effects:
-
To enable read-only mode for the dashboard, use this URL:
https://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/dashboard/${dashboardID}?readOnly=trueWhen read-only mode is enabled, the dashboard's top toolbar displays only view-related buttons, like 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 this URL. The filter condition stringfilters=key1:value1&filters=key2:value2is encoded tofilters%3Dkey1%3Avalue1%26filters%3Dkey2%3Avalue2.https://sls4servims.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 this 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://sls4servims.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 automatically refresh the dashboard every 5 minutes, use this URL:
https://sls4servims.console.alibabacloud.com/lognext/project/${ProjectName}/dashboard/${dashboardID}?autoFresh=5m
Tree structure parameters
Tree structure parameters define 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 |
Specifies whether to display the search box. Default value: |
|
resourceList |
String[] |
No |
Specifies the list of resources to display. Only resources with names that exactly match an entry in this array are shown. If this parameter is not configured, all resources of the corresponding type are displayed by default. |
|
expand |
boolean |
No |
Specifies 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://sls4servims.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 you embed a dashboard in an iframe, the iframe height is not automatically set. This can create two scroll bars: one for the parent page and another for the dashboard within the iframe. Use advanced parameters to make the dashboard height adjust automatically.
You can get the iframe height from the dashboardHeight property, which Simple Log Service passes in a postmessage event. The following code shows an 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://sls4servims.console.alibabacloud.com/lognext/project/${projectName}/dashboard/${dashboardName}?product=${productCode}">
</body>
</html>