Migrated from ovh_apache
This commit is contained in:
2 files changed
+83
-4
No files matched your search
+62
-4
@@ -207,19 +207,76 @@
|
||||
</ul>
|
||||
|
||||
<?php
|
||||
$url = "https://mattermost.gnous.fr/api/v4/analytics/old";
|
||||
$url = "https://mon.gnous.fr:9200/stats-*/_search";
|
||||
$headers = array(
|
||||
"Accept: application/json",
|
||||
"Authorization: Bearer ".$_ENV["MM_TOKEN"],
|
||||
"Content-Type: application/json",
|
||||
"Authorization: Basic ".$_ENV["ES_TOKEN"],
|
||||
);
|
||||
$params = '
|
||||
{
|
||||
"sort": { "@timestamp": "desc"},
|
||||
"size": 5,
|
||||
"query": {
|
||||
"bool": {
|
||||
"filter": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"fields.stats": "mattermost"
|
||||
}
|
||||
},
|
||||
{
|
||||
"bool": {
|
||||
"should": [
|
||||
{
|
||||
"match_phrase": {
|
||||
"stats.name": "post_count"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match_phrase": {
|
||||
"stats.name": "channel_open_count"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match_phrase": {
|
||||
"stats.name": "channel_private_count"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match_phrase": {
|
||||
"stats.name": "unique_user_count"
|
||||
}
|
||||
},
|
||||
{
|
||||
"match_phrase": {
|
||||
"stats.name": "team_count"
|
||||
}
|
||||
}
|
||||
],
|
||||
"minimum_should_match": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"fields": [
|
||||
"stats.*"
|
||||
],
|
||||
"_source" :false
|
||||
}';
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
curl_setopt($ch, CURLOPT_CAINFO,'./ressources/elasticsearch-ca.pem');
|
||||
curl_setopt($ch, CURLOPT_CAPATH,'./ressources/elasticsearch-ca.pem');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, true);
|
||||
|
||||
$data_json = curl_exec($ch);
|
||||
|
||||
echo $data_json;
|
||||
//var_dump(json_decode($data_json));
|
||||
$status_code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
||||
|
||||
curl_close($ch);
|
||||
@@ -397,3 +454,4 @@ if ($status_code==200) {
|
||||
<?php include 'includes/footer.php'; ?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in new issue
Block a user