Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 count 会有 notice #20

Closed
BestKind opened this issue Jul 4, 2019 · 0 comments
Closed

使用 count 会有 notice #20

BestKind opened this issue Jul 4, 2019 · 0 comments

Comments

@BestKind
Copy link

BestKind commented Jul 4, 2019

使用 sample.php 中的 getLogs 方法,将其中的 query 的为 " query | timeslice 24h | count " 时会有 notice

PHP Notice: Undefined index: source in ******/aliyun-log-php-sdk/Aliyun/Log/Models/Response/GetLogsResponse.php on line 48

sample/sample.php 文件改造如下:

 58 function getLogs(Aliyun_Log_Client $client, $project, $logstore) {
 59     // $topic = 'TestTopic';
 60     $topic = '';
 61     $from = time()-86400;
 62     $to = time();
 63     $query = 'type:adc | timeslice 12h | count';
 64     // $query = '';
 65     $request = new Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, $query, 100, 0, False);
 66
 67     try {
 68         $response = $client->getLogs($request);
 69         foreach($response -> getLogs() as $log)
 70         {
 71             print $log -> getTime()."\t";
 72             foreach($log -> getContents() as $key => $value){
 73                 print $key.":".$value."\t";
 74             }
 75             print "\n";
 76         }
 77
 78     } catch (Aliyun_Log_Exception $ex) {
 79         logVarDump($ex);
 80     } catch (Exception $ex) {
 81         logVarDump($ex);
 82     }
 83 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant