forked from galaxydi/go-loghub
-
Notifications
You must be signed in to change notification settings - Fork 113
/
log_logstore.go
41 lines (37 loc) · 954 Bytes
/
log_logstore.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"time"
"github.com/aliyun/aliyun-log-go-sdk"
"github.com/aliyun/aliyun-log-go-sdk/example/util"
)
func main() {
err := util.Client.CreateLogStore(util.ProjectName,util.LogStoreName,2,2,true,64)
if err != nil {
panic(err)
}
logstore, err := util.Client.GetLogStore(util.ProjectName, util.LogStoreName)
if err != nil {
panic(err)
}
fmt.Println("create logstore successfully:", logstore.Name)
updateLogstore := &sls.LogStore{
Name:util.LogStoreName,
TTL:2,
ShardCount:10,
AutoSplit:false,
WebTracking:true,
}
err = util.Client.UpdateLogStoreV2(util.ProjectName,updateLogstore)
if err != nil {
panic(err)
}
fmt.Println("update logstore suecessed")
fmt.Println("Prepare to delete the logstore after 30 seconds")
time.Sleep(30 * time.Second)
err = util.Client.DeleteLogStore(util.ProjectName, util.LogStoreName)
if err != nil {
panic(err)
}
fmt.Println("Delete Logstore successfully")
}