百度智能云

All Product Document

          CDN

          Log Interface

          Get Single Domain Name Log GetDomainLog

          cli := client.GetDefaultClient()                                    
          testDomain := "test_go_sdk.baidu.com"                               
          endTime := "2019-09-01T07:12:00Z"                                   
          startTime := "2019-09-09T07:18:00Z"                                 
          domainLogs, err := cli.GetDomainLog(testDomain, api.TimeInterval{   
          	 StartTime: startTime,                                           
          	 EndTime:   endTime,                                             
          })                                                                  
                                                                              
          fmt.Printf("domainLogs:%+v\n", domainLogs)                          
          fmt.Printf("err:%+v\n", err)                                        

          The example queries logs of a single domain name between 2019-09-01T07:12:00Z and 2019-09-09T07:18:00Z. domainLogs is an array type of api.LogEntry. LogEntry contains information such as log name, domain name, download path and start time.

          Access Multiple Logs of Domain Name GetMultiDomainLog

          cli := client.GetDefaultClient()                              
          endTime := "2019-09-01T07:12:00Z"                             
          startTime := "2019-09-09T07:18:00Z"                           
                                                                        
          domainLogs, err := cli.GetMultiDomainLog(&api.LogQueryData{   
          	 TimeInterval: api.TimeInterval{                           
          	 	 StartTime: startTime,                                 
          	 	 EndTime:   endTime,                                   
          	 },                                                        
          	 Type:    1,                                               
          	 Domains: []string{"1.baidu.com", "2.baidu.com"},          
          })                                                            
                                                                        
          fmt.Printf("domainLogs:%+v\n", domainLogs)                    
          fmt.Printf("err:%+v\n", err)                                  

          Example query ["1.baidu.com", "2.baidu.com"] the logs of these domain names, the returned format of domainLogs is the same as GetDomainLog in previous clip.

          Previous
          Statistical Interface (new version)
          Next
          Tool Interface