@@ -107,6 +107,60 @@ function getLogsWithPowerSql(Aliyun_Log_Client $client, $project, $logstore) {
107107 logVarDump ($ ex );
108108 }
109109}
110+ function getProjectLogsWithPowerSql (Aliyun_Log_Client $ client , $ project ) {
111+ $ query = " select count(method) from sls_operation_log where __time__ > to_unixtime(now()) - 300 and __time__ < to_unixtime(now()) " ;
112+ $ request = new Aliyun_Log_Models_GetProjectLogsRequest ($ project , $ query , True );
113+
114+ try {
115+ $ response = $ client ->getProjectLogs ($ request );
116+ #$response = $client->getProjectLogs($request);
117+ foreach ($ response -> getLogs () as $ log )
118+ {
119+ print $ log -> getTime ()."\t" ;
120+ foreach ($ log -> getContents () as $ key => $ value ){
121+ print $ key .": " .$ value ."\t" ;
122+ }
123+ print "\n" ;
124+ }
125+ print "proccesedRows: " .$ response -> getProcessedRows ()."\n" ;
126+ print "elapsedMilli: " .$ response -> getElapsedMilli ()."\n" ;
127+ print "cpuSec: " .$ response -> getCpuSec ()."\n" ;
128+ print "cpuCores: " .$ response -> getCpuCores ()."\n" ;
129+ print "requestId: " .$ response ->getRequestId ()."\n" ;
130+
131+ } catch (Aliyun_Log_Exception $ ex ) {
132+ logVarDump ($ ex );
133+ } catch (Exception $ ex ) {
134+ logVarDump ($ ex );
135+ }
136+ }
137+ function executeProjectSqlWithPowerSql (Aliyun_Log_Client $ client , $ project ) {
138+ $ query = " select count(method) from sls_operation_log where __time__ > to_unixtime(now()) - 300 and __time__ < to_unixtime(now()) " ;
139+ $ request = new Aliyun_Log_Models_ProjectSqlRequest ($ project , $ query , True );
140+
141+ try {
142+ $ response = $ client ->executeProjectSql ($ request );
143+ #$response = $client->getProjectLogs($request);
144+ foreach ($ response -> getLogs () as $ log )
145+ {
146+ print $ log -> getTime ()."\t" ;
147+ foreach ($ log -> getContents () as $ key => $ value ){
148+ print $ key .": " .$ value ."\t" ;
149+ }
150+ print "\n" ;
151+ }
152+ print "proccesedRows: " .$ response -> getProcessedRows ()."\n" ;
153+ print "elapsedMilli: " .$ response -> getElapsedMilli ()."\n" ;
154+ print "cpuSec: " .$ response -> getCpuSec ()."\n" ;
155+ print "cpuCores: " .$ response -> getCpuCores ()."\n" ;
156+ print "requestId: " .$ response ->getRequestId ()."\n" ;
157+
158+ } catch (Aliyun_Log_Exception $ ex ) {
159+ logVarDump ($ ex );
160+ } catch (Exception $ ex ) {
161+ logVarDump ($ ex );
162+ }
163+ }
110164function crudSqlInstance (Aliyun_Log_Client $ client ,$ project ){
111165 $ res = $ client -> createSqlInstance ($ project ,1000 );
112166 logVarDump ($ res );
@@ -285,5 +339,7 @@ function logVarDump($expression){
285339#listTopics($client, $project, $logstore);
286340#getHistograms($client, $project, $logstore);
287341#getLogs($client, $project, $logstore);
342+ executeProjectSqlWithPowerSql ($ client ,$ project );
343+ getProjectLogsWithPowerSql ($ client ,$ project );
288344getLogsWithPowerSql ($ client , $ project , $ logstore );
289345crudSqlInstance ($ client ,$ project );
0 commit comments