The following sections describe how to configure DataV to render data from Log Service.
The following sections describe how to:
- Create and configure Log Service to work with DataV (set indexes).
- Create a sample dashboard.
- Share the dashboard publicly.
Prerequisites
- You must have completed Configure Log4JAppender with Kubernetes and Log Service and the service is currently running.
- You must have purchased DataV Enterprise Edition.
Configure Log Service
- Visit the Logstore List page within your project.
- Click Search next to the name of your project. The following page is displayed:
- Create indices for all required fields. The following example creates an index for each item. Click Index Attributes from the upper menu of the page and click Modify.
- Verify the data from the Search & Analysis page:
- Once the data has been imported properly, switch to Graph view (in the following graph, the axis is ‘time’):
Configure DataV
- Visit the DataV product page to create your first project.
- Click Create Project, select a blank template, and click Create.
- Add a widget to the dashboard.The widget displays some sample static dataset.
- Click the widget and, select the Log Service (SLS) from Data Source Type from the Data tab on the right side.
- Click Create in the Select Data Source. The New data dialog is displayed, fill in the relevant information, and click OK.
Note Make sure you add
http://
orhttps://
in the Endpoint field. - Once completed, select the newly created Source. The following example uses a simple
example query:
{ "projectName": "k8s-logs", "logStoreName": "k8s-logstore", "topic": "", "from": "1518883200", "to": "1518969600", "query": "* | select count(1) as pv, date_format(from_unixtime(__time__ - __time__%3600) ,'%Y/%m/%d %H:%i:%s') as time group by time order by time limit 1000" , "line": 100, "offset": 0 }
Note from and to are the timestamps you can use to examine raw data in the Search console. - Preview the data by clicking View Data Response button at the lower-side of the window. The following response result window is displayed:
- Click Select Filter and apply the following filter to make sure the
pv
is an integer, and click OK.return Object.keys(data).map((key) => { let d= data[key]; d["pv"] = parseInt(d["pv"]); return d; } )
- Set the axes and verify the settings are set correctly.
- Click Preview.
You can see that
x
andy
use the correct data type, andpv
is an integer. - To share this dashboard publicly, click Publish in the upper-right corner of the page.
An example of a completed and published DataV dashboard, using a dataset from a Log Service data, is as follows:
Conclusion
You have successfully configured DataV and Log Service together on Alibaba Cloud and used Log Service to perform real-time monitoring by means of a custom dashboard.
References
For more information on Log Service and containers, see