Overview
The ES Serverless service supports writing data into indexes through methods such as ES native APIs, Logstash, Flink, and Kafka. If you require log collection for services such as CVM, TKE, or TCHouse-C, a one-stop visualized configuration option is also available. By simply setting up data sources and index information, you can collected logs into the indexes for efficient retrieval and analysis. This document provides instructions for writing a single document and writing document in batches using Kibana and Curl commands. Access Control
1. In the Project list, click the corresponding project name to enter the Basic Info page.
2. In the Access Control module, you can view the username and password for the index, private network access address, Kibana private network access address, and Kibana public network access address. You can also configure the Kibana public network access policy.
3. Access Kibana: The Discover and Dev Tools features of Kibana are embedded in the Tencent Cloud console, allowing you to use retrieval and analysis capabilities directly within the console or access Kibana via an external link.
Via Console: In the sidebar of the space details page, click Search and Analysis to enter the relevant page. You can switch between index views by clicking the index pattern dropdown on the left side. Log Search corresponds to Discover, and Development Tools corresponds to Dev Tools.
Note:
Embedded features require third-party cookies to be enabled in your browser. If you encounter issues, please enable third-party cookies in your browser settings.
Via Kibana Public Network Access Address: Click Kibana public network access address to enter the Kibana page.
On the Kibana login page, enter the username and password, which can be copied directly from the user management page.
After entering the Kibana page, click the three-bar icon in the upper right corner, then click Dev Tools to enter the development tools page.
Note:
Kibana public network access includes an allowlist mechanism, meaning that IP addresses not included in the access policy cannot access Kibana, enhancing access security. If the page displays Sorry, you do not have permissions to access, click Kibana Public Network Access Policy as shown above. In the pop-up window, click Get current IP to enter your current IP address to the allowlist.
Writing a Single Document
POST /index name/_doc
{
"@timestamp": "2023-09-28T11:06:07.000Z",
"user":{
"id" : "8a4f500"
},
"message": "Login successful"
}
Via Command Line
curl -X POST "project space access address/index name/_doc/?pretty" -H 'Content-Type: application/json' -d'
{
"@timestamp": "2023-09-28T11:06:07.000Z",
"user": {
"id": "8a4f500d"
},
"message": "Login successful"
}
Caution
The PUT /index name/_doc/document ID
format cannot be used for writing requests. To specify a document ID, use PUT /index name/_create/document ID
.
Ensure that the written data includes the Time Field set during index creation.
Writing Document in Batches
PUT /index name/_bulk?refresh
{"create":{ }}
{ "@timestamp": "2023-03-28T11:04:05.000Z", "user": { "id": "vlb44hny" }, "message": "Login attempt failed" }
{"create":{ }}
{ "@timestamp": "2023-03-29T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
{"create":{ }}
{ "@timestamp": "2023-03-30T11:07:08.000Z", "user": { "id": "l7gk7f82" }, "message": "Logout successful" }
Via Command Line
curl -X PUT "project space access address/index name/_bulk?refresh&pretty" -H 'Content-Type: application/json' -d'
{"create":{ }}
{ "@timestamp": "2023-03-28T11:04:05.000Z", "user": { "id": "vlb44hny" }, "message": "Login attempt failed" }
{"create":{ }}
{ "@timestamp": "2023-03-29T11:06:07.000Z", "user": { "id": "8a4f500d" }, "message": "Login successful" }
{"create":{ }}
{ "@timestamp": "2023-03-30T11:07:08.000Z", "user": { "id": "l7gk7f82" }, "message": "Logout successful" }
'
Caution
The bulk operation only supports create
.
Ensure that the written data includes the Time Field set during index creation.
Was this page helpful?