天天看點

通過ES接口監控日志

curl -L -X POST -u elastic:123456 'http://127.0.0.1:9200/nginx*/_search?pretty' -H 'Content-Type: application/json' -d '{

  "track_total_hits": true,

 "sort": [

   {

       "@timestamp": {

         "order": "desc",

         "unmapped_type": "boolean"

       }

   }

 ],

 "fields": [

   {

       "field": "*",

       "include_unmapped": "true"

   },

   {

       "field": "@timestamp",

       "format": "strict_date_optional_time"

   }

 ],

 "aggs": {

   "NAME": {

       "percentiles": {

         "field": "requestTime",

         "percents": [

           80

         ]

       }

   }

 },

 "size": 0,

 "version": true,

 "script_fields": {},

 "stored_fields": [

   "*"

 ],

 "runtime_mappings": {},

 "_source": false,

 "query": {

   "bool": {

       "must": [],

       "filter": [

         {

           "bool": {

               "should": [

                 {

                   "match_phrase": {

                       "url": "applo"

                   }

                 }

               ],

               "minimum_should_match": 1

           }

         },

         {

           "range": {

               "@timestamp": {

                 "format": "strict_date_optional_time",

                 "gte": "now-5m",

                 "lte": "now"

               }

           }

         }

       ],

       "should": [],

       "must_not": []

   }

 },

 "highlight": {

   "pre_tags": [

       "@kibana-highlighted-field@"

   ],

   "post_tags": [

       "@/kibana-highlighted-field@"

   ],

   "fields": {

       "*": {}

   },

繼續閱讀