Index: bootstrap/css/bootstrap-theme.css =================================================================== diff -u -rb2cda0742bff7e718fcf0ee5eaaeb142d632b849 -r10924cd1b76b39abdfbdea904a9dfae901d9ab2f --- bootstrap/css/bootstrap-theme.css (.../bootstrap-theme.css) (revision b2cda0742bff7e718fcf0ee5eaaeb142d632b849) +++ bootstrap/css/bootstrap-theme.css (.../bootstrap-theme.css) (revision 10924cd1b76b39abdfbdea904a9dfae901d9ab2f) @@ -511,6 +511,11 @@ + +
+ +
+ Index: ARMS/packetbeatReqTemplate.js =================================================================== diff -u --- ARMS/packetbeatReqTemplate.js (revision 0) +++ ARMS/packetbeatReqTemplate.js (revision 10924cd1b76b39abdfbdea904a9dfae901d9ab2f) @@ -0,0 +1,93 @@ +function packetbeat(selectedNodeHost){ + + console.log("<== packetbeat ==> "); + console.log("before savedNodeHost ==> " + savedNodeHost); + if(typeof selectedNodeHost == "undefined" || selectedNodeHost == null || selectedNodeHost == "") + console.log("savedNodeHost = " + savedNodeHost); + else + savedNodeHost = $.trim(selectedNodeHost); + + var start = $("#reservationtime").data().daterangepicker.startDate; + console.log("start hour check = " + start.format('H')); + var startHours = parseInt(start.format('H')); + var startHoursStr; + if(startHours < 10){ + startHoursStr = "0" + startHours; + }else{ + startHoursStr = startHours; + } + var searchStartStr = start.format('YYYY-MM-DD') + "T" + startHoursStr + start.format(':mm:ss') + ".000Z"; + console.log("searchStartStr check = " + searchStartStr); + + var end = $("#reservationtime").data().daterangepicker.endDate; + console.log("end hour check = " + end.format('H')); + var endHours = parseInt(end.format('H')); + var endHoursStr; + if(endHours < 10){ + endHoursStr = "0" + endHours; + }else{ + endHoursStr = endHours; + } + var searchEndStr = end.format('YYYY-MM-DD') + "T" + endHoursStr + end.format(':mm:ss') + ".000Z"; + console.log("searchEndStr check = " + searchEndStr); + + console.log("after savedNodeHost ==> " + savedNodeHost); + + $.getJSON("packetbeatReqTemplate.json", function (reqdata) { + console.log(reqdata.query.bool.filter[1].range["@timestamp"].gte); + reqdata.query.bool.filter[1].range["@timestamp"].gte = searchStartStr; + reqdata.query.bool.filter[1].range["@timestamp"].lte = searchEndStr; + reqdata.query.bool.filter[0].bool.should[0].match["agent.hostname"] = savedNodeHost; + + var queryString = JSON.stringify(reqdata); + console.log(queryString); + + var url = ""; + var type = ""; + if($(location).attr('port') == 9999){ + url = "/api/elasticsearch/packetbeat/search/api.json"; + type = "get"; + }else{ + url="/elasticsearch/packetbeat-*/_search"; + type = "post"; + } + + $.ajax({ + url : url, + type : type, + data : queryString, + dataType : 'json', + jsonp : false, + timeout : 31313, + global : true, + contentType : 'application/json;charset=UTF-8', + cache : false, + success : function(data) { + + console.log("packetbeat response data = " + JSON.stringify(data)); + var chartLabels = []; + var chartData1 = []; + + var filteredObj = data.aggregations[2].buckets; + + $.each(filteredObj, function(inx, obj){ + chartLabels.push(obj.key_as_string); + chartData1.push(obj.doc_count); + }); + + var config = { + type: 'bar', + data: { + labels: chartLabels, + datasets: [{ + label: 'packet chart', + data: chartData1, + backgroundColor: 'rgba(0, 119, 204, 0.3)' + }] + } + } + new Chart(document.getElementById('packetbeatCanvas'), config); + } + }); + }); +} \ No newline at end of file Index: ARMS/packetbeatReqTemplate.json =================================================================== diff -u --- ARMS/packetbeatReqTemplate.json (revision 0) +++ ARMS/packetbeatReqTemplate.json (revision 10924cd1b76b39abdfbdea904a9dfae901d9ab2f) @@ -0,0 +1,64 @@ +{ + "aggs": { + "2": { + "date_histogram": { + "field": "@timestamp", + "fixed_interval": "30s", + "time_zone": "Asia/Seoul", + "min_doc_count": 1 + } + } + }, + "size": 0, + "_source": { + "excludes": [] + }, + "stored_fields": [ + "*" + ], + "script_fields": {}, + "docvalue_fields": [ + { + "field": "@timestamp", + "format": "date_time" + }, + { + "field": "event.end", + "format": "date_time" + }, + { + "field": "event.start", + "format": "date_time" + } + ], + "query": { + "bool": { + "must": [], + "filter": [ + { + "bool": { + "should": [ + { + "match": { + "agent.hostname": "9eb75e7e6e3e" + } + } + ], + "minimum_should_match": 1 + } + }, + { + "range": { + "@timestamp": { + "format": "strict_date_optional_time", + "gte": "2020-12-26T13:59:51.360Z", + "lte": "2020-12-26T14:14:51.360Z" + } + } + } + ], + "should": [], + "must_not": [] + } + } +} \ No newline at end of file Index: api/elasticsearch/packetbeat/search/api.json =================================================================== diff -u --- api/elasticsearch/packetbeat/search/api.json (revision 0) +++ api/elasticsearch/packetbeat/search/api.json (revision 10924cd1b76b39abdfbdea904a9dfae901d9ab2f) @@ -0,0 +1,177 @@ +{ + "took": 1976, + "timed_out": false, + "_shards": { + "total": 47, + "successful": 46, + "skipped": 0, + "failed": 0 + }, + "hits": { + "total": 4247, + "max_score": null, + "hits": [] + }, + "aggregations": { + "2": { + "buckets": [ + { + "key_as_string": "2020-12-26T22:59:30.000+09:00", + "key": 1608991170000, + "doc_count": 39 + }, + { + "key_as_string": "2020-12-26T23:00:00.000+09:00", + "key": 1608991200000, + "doc_count": 137 + }, + { + "key_as_string": "2020-12-26T23:00:30.000+09:00", + "key": 1608991230000, + "doc_count": 140 + }, + { + "key_as_string": "2020-12-26T23:01:00.000+09:00", + "key": 1608991260000, + "doc_count": 139 + }, + { + "key_as_string": "2020-12-26T23:01:30.000+09:00", + "key": 1608991290000, + "doc_count": 141 + }, + { + "key_as_string": "2020-12-26T23:02:00.000+09:00", + "key": 1608991320000, + "doc_count": 142 + }, + { + "key_as_string": "2020-12-26T23:02:30.000+09:00", + "key": 1608991350000, + "doc_count": 141 + }, + { + "key_as_string": "2020-12-26T23:03:00.000+09:00", + "key": 1608991380000, + "doc_count": 137 + }, + { + "key_as_string": "2020-12-26T23:03:30.000+09:00", + "key": 1608991410000, + "doc_count": 146 + }, + { + "key_as_string": "2020-12-26T23:04:00.000+09:00", + "key": 1608991440000, + "doc_count": 148 + }, + { + "key_as_string": "2020-12-26T23:04:30.000+09:00", + "key": 1608991470000, + "doc_count": 146 + }, + { + "key_as_string": "2020-12-26T23:05:00.000+09:00", + "key": 1608991500000, + "doc_count": 140 + }, + { + "key_as_string": "2020-12-26T23:05:30.000+09:00", + "key": 1608991530000, + "doc_count": 143 + }, + { + "key_as_string": "2020-12-26T23:06:00.000+09:00", + "key": 1608991560000, + "doc_count": 141 + }, + { + "key_as_string": "2020-12-26T23:06:30.000+09:00", + "key": 1608991590000, + "doc_count": 141 + }, + { + "key_as_string": "2020-12-26T23:07:00.000+09:00", + "key": 1608991620000, + "doc_count": 143 + }, + { + "key_as_string": "2020-12-26T23:07:30.000+09:00", + "key": 1608991650000, + "doc_count": 143 + }, + { + "key_as_string": "2020-12-26T23:08:00.000+09:00", + "key": 1608991680000, + "doc_count": 137 + }, + { + "key_as_string": "2020-12-26T23:08:30.000+09:00", + "key": 1608991710000, + "doc_count": 145 + }, + { + "key_as_string": "2020-12-26T23:09:00.000+09:00", + "key": 1608991740000, + "doc_count": 146 + }, + { + "key_as_string": "2020-12-26T23:09:30.000+09:00", + "key": 1608991770000, + "doc_count": 146 + }, + { + "key_as_string": "2020-12-26T23:10:00.000+09:00", + "key": 1608991800000, + "doc_count": 139 + }, + { + "key_as_string": "2020-12-26T23:10:30.000+09:00", + "key": 1608991830000, + "doc_count": 139 + }, + { + "key_as_string": "2020-12-26T23:11:00.000+09:00", + "key": 1608991860000, + "doc_count": 104 + }, + { + "key_as_string": "2020-12-26T23:11:30.000+09:00", + "key": 1608991890000, + "doc_count": 147 + }, + { + "key_as_string": "2020-12-26T23:12:00.000+09:00", + "key": 1608991920000, + "doc_count": 161 + }, + { + "key_as_string": "2020-12-26T23:12:30.000+09:00", + "key": 1608991950000, + "doc_count": 141 + }, + { + "key_as_string": "2020-12-26T23:13:00.000+09:00", + "key": 1608991980000, + "doc_count": 137 + }, + { + "key_as_string": "2020-12-26T23:13:30.000+09:00", + "key": 1608992010000, + "doc_count": 144 + }, + { + "key_as_string": "2020-12-26T23:14:00.000+09:00", + "key": 1608992040000, + "doc_count": 158 + }, + { + "key_as_string": "2020-12-26T23:14:30.000+09:00", + "key": 1608992070000, + "doc_count": 96 + } + ] + } + }, + "status": 200 +} \ No newline at end of file