You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by th...@apache.org on 2015/11/07 02:54:14 UTC
[10/10] incubator-apex-malhar git commit: Cleanup of web resources
Cleanup of web resources
Project: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/commit/f0863913
Tree: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/tree/f0863913
Diff: http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/diff/f0863913
Branch: refs/heads/release-3.2
Commit: f08639139cb46b7f8162a9187b9c3eff243df809
Parents: 862e157
Author: Pramod Immaneni <pr...@datatorrent.com>
Authored: Fri Nov 6 10:58:17 2015 -0800
Committer: Pramod Immaneni <pr...@datatorrent.com>
Committed: Fri Nov 6 10:58:17 2015 -0800
----------------------------------------------------------------------
apps/logstream/src/main/html/ClientData.js | 39 +
apps/logstream/src/main/html/ClientData.php | 33 +
.../src/main/html/DrawPageViewTimeChart.js | 173 +
.../src/main/html/PageViewTimeData.php | 109 +
apps/logstream/src/main/html/Server404.php | 37 +
apps/logstream/src/main/html/ServerLoad.php | 100 +
.../logstream/src/main/html/TopIpClientChart.js | 55 +
.../logstream/src/main/html/TopIpClientData.php | 37 +
apps/logstream/src/main/html/TopIpData.js | 54 +
apps/logstream/src/main/html/TopIpData.php | 37 +
apps/logstream/src/main/html/TopServer.js | 53 +
apps/logstream/src/main/html/TopServer.php | 37 +
apps/logstream/src/main/html/TopUrlChart.js | 53 +
apps/logstream/src/main/html/TopUrlData.php | 37 +
apps/logstream/src/main/html/TotalViews.js | 38 +
apps/logstream/src/main/html/TotalViews.php | 27 +
apps/logstream/src/main/html/Url404.js | 64 +
apps/logstream/src/main/html/Url404.php | 37 +
apps/logstream/src/main/html/global.js | 133 +
apps/logstream/src/main/html/index.php | 176 +
apps/logstream/src/main/html/info.php | 22 +
apps/logstream/src/main/html/malhar.css | 4564 +++++++++++++++++
apps/logstream/src/main/html/server.js | 115 +
apps/logstream/src/main/html/serverfail.js | 64 +
contrib/src/main/html/adsdimension/global.js | 379 --
contrib/src/main/html/adsdimension/index.php | 235 -
contrib/src/main/html/adsdimension/json.php | 84 -
.../src/main/html/adsdimension/main_banner.png | Bin 2181 -> 0 bytes
contrib/src/main/html/adsdimension/malhar.css | 4688 ------------------
contrib/src/main/html/machinedata/global.js | 269 -
contrib/src/main/html/machinedata/index.php | 269 -
contrib/src/main/html/machinedata/json.php | 96 -
.../src/main/html/machinedata/main_banner.png | Bin 10002 -> 0 bytes
contrib/src/main/html/machinedata/malhar.css | 4688 ------------------
contrib/src/main/html/siteops/ClientData.js | 39 -
contrib/src/main/html/siteops/ClientData.php | 33 -
.../main/html/siteops/DrawPageViewTimeChart.js | 173 -
.../src/main/html/siteops/PageViewTimeData.php | 109 -
contrib/src/main/html/siteops/Server404.php | 37 -
contrib/src/main/html/siteops/ServerLoad.php | 100 -
.../src/main/html/siteops/TopIpClientChart.js | 55 -
.../src/main/html/siteops/TopIpClientData.php | 37 -
contrib/src/main/html/siteops/TopIpData.js | 54 -
contrib/src/main/html/siteops/TopIpData.php | 37 -
contrib/src/main/html/siteops/TopServer.js | 53 -
contrib/src/main/html/siteops/TopServer.php | 37 -
contrib/src/main/html/siteops/TopUrlChart.js | 53 -
contrib/src/main/html/siteops/TopUrlData.php | 37 -
contrib/src/main/html/siteops/TotalViews.js | 38 -
contrib/src/main/html/siteops/TotalViews.php | 27 -
contrib/src/main/html/siteops/Url404.js | 64 -
contrib/src/main/html/siteops/Url404.php | 37 -
contrib/src/main/html/siteops/global.js | 133 -
contrib/src/main/html/siteops/index.php | 177 -
contrib/src/main/html/siteops/info.php | 22 -
contrib/src/main/html/siteops/main_banner.png | Bin 2181 -> 0 bytes
contrib/src/main/html/siteops/malhar.css | 4564 -----------------
contrib/src/main/html/siteops/server.js | 115 -
contrib/src/main/html/siteops/serverfail.js | 64 -
demos/machinedata/src/main/html/global.js | 269 +
demos/machinedata/src/main/html/index.php | 268 +
demos/machinedata/src/main/html/json.php | 96 +
demos/machinedata/src/main/html/malhar.css | 4688 ++++++++++++++++++
63 files changed, 11415 insertions(+), 16803 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/ClientData.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/ClientData.js b/apps/logstream/src/main/html/ClientData.js
new file mode 100644
index 0000000..28df87a
--- /dev/null
+++ b/apps/logstream/src/main/html/ClientData.js
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top url table.
+ */
+
+function DrawClientDataTableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ var pts = JSON.parse(data);
+ document.getElementById('totaldata').innerHTML = pts[0];
+ }
+ }
+ connect.open('GET', "ClientData.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/ClientData.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/ClientData.php b/apps/logstream/src/main/html/ClientData.php
new file mode 100644
index 0000000..5e97e96
--- /dev/null
+++ b/apps/logstream/src/main/html/ClientData.php
@@ -0,0 +1,33 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(9);
+
+// result array
+$result = array();
+
+$value = $redis->get(1);
+$result[] = $value;
+
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/DrawPageViewTimeChart.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/DrawPageViewTimeChart.js b/apps/logstream/src/main/html/DrawPageViewTimeChart.js
new file mode 100644
index 0000000..9a71f14
--- /dev/null
+++ b/apps/logstream/src/main/html/DrawPageViewTimeChart.js
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions for drawing page view vs time chart.
+ */
+
+
+function PageViewTimeDataUrl()
+{
+ var url = "PageViewTimeData.php?";
+ url += "from=";
+ url += Math.floor(pageViewLookback);
+ if (pageViewUrl)
+ {
+ url += "&url=" + pageViewUrl;
+ }
+ //url += "&url=mydomain.com/services.php?serviceid=6";
+ return url;
+}
+
+function RenderPageViewTimeChart()
+{
+ // create/delete rows
+ if (pageViewTable.getNumberOfRows() < pageDataPoints.length)
+ {
+ var numRows = pageDataPoints.length - pageViewTable.getNumberOfRows();
+ pageViewTable.addRows(numRows);
+ } else {
+ for(var i=(pageViewTable.getNumberOfRows()-1); i >= pageDataPoints.length; i--)
+ {
+ pageViewTable.removeRow(i);
+ }
+ }
+
+ // Populate data table with time/cost data points.
+ for(var i=0; i < pageViewTable.getNumberOfRows(); i++)
+ {
+ //if(parseFloat(aggrDataPoints[i].cost) < 500) continue;
+ pageViewTable.setCell(i, 0, new Date(parseInt(pageDataPoints[i].timestamp)));
+ pageViewTable.setCell(i, 1, parseFloat(pageDataPoints[i].view));
+ }
+
+ // get options
+ var page = document.getElementById('page').value;
+ var index = document.getElementById('index').value;
+ var title = "ALL Urls (PVS/Min)";
+ if (page == "home") title = "home.php (PVS/Min)";
+ if (page == "contact") title = "contactus.php (PVS/Min)";
+ if (page == "about") title = "about.php (PVS/Min)";
+ if (page == "support") title = "support.php (PVS/Min)";
+ if (page == "product") {
+ title = "product.php-" + index + " (PVS/Min)";
+ }
+ if (page == "services") {
+ title = "services.php-" + index + " (PVS/Min)";
+ }
+ if (page == "products") {
+ title = "products.php-" + index + " (PVS/Min)";
+ }
+
+ var options = { pointSize: 0, lineWidth : 1, legend : {position : 'top'} };
+ options.title = title;
+
+ // Draw line chart.
+ pageViewChart.draw(PageViewView, options);
+}
+
+function DrawPageViewTimeChart()
+{
+ var url = PageViewTimeDataUrl();
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ pageViewData = connect.response;
+ var pts = JSON.parse(pageViewData);
+ for(var i=0; i < pts.length; i++)
+ {
+ pageDataPoints.push(pts[i]);
+ delete pts[i];
+ }
+ delete pts;
+ sortByKey(pageDataPoints, "timestamp");
+ RenderPageViewTimeChart();
+ delete pageViewData;
+ delete pageDataPoints;
+ pageDataPoints = new Array();
+ }
+ }
+ connect.open('GET', url, true);
+ connect.send(null);
+ } catch(e) {
+ }
+ pageViewLookback = (new Date().getTime()/1000) - (3600 * pageViewInterval)-60;
+}
+
+
+function HandlePageViewTimeSubmit()
+{
+ // remove old time
+ if(pageNowPlaying) clearInterval(pageNowPlaying);
+
+ // get submit values
+ var page = document.getElementById('page').value;
+ var index = document.getElementById('index').value;
+ if (page == "all") pageViewUrl ="";
+ if (page == "home") pageViewUrl = "mydomain.com/home.php";
+ if (page == "contact") pageViewUrl = "mydomain.com/contactus.php";
+ if (page == "about") pageViewUrl = "mydomain.com/about.php";
+ if (page == "support") pageViewUrl = "mydomain.com/support.php";
+ if (page == "product")
+ {
+ pageViewUrl = "mydomain.com/products.php";
+ if (index && (index.length > 0)) pageViewUrl += "?productid=" + index;
+ }
+ if (page == "services")
+ {
+ pageViewUrl = "mydomain.com/services.php";
+ if (index && (index.length > 0)) pageViewUrl += "?serviceid=" + index;
+ }
+ if (page == "partners")
+ {
+ pageViewUrl = "mydomain.com/partners.php";
+ if (index && (index.length > 0)) pageViewUrl += "?partnerid=" + index;
+ }
+ pageViewLookback = document.getElementById('pageviewlookback').value;
+ if ( !pageViewLookback || (pageViewLookback == "")) {
+ pageViewLookback = (new Date().getTime()/1000) - 3600;
+ } else {
+ pageViewLookback = (new Date().getTime()/1000) - 3600 * pageViewLookback;
+ }
+
+ // set from values
+ document.getElementById('page').value = page;
+ document.getElementById('index').value = index;
+ var lookback = document.getElementById('pageviewlookback').value;
+ document.getElementById('pageviewlookback').value = lookback;
+ pageViewInterval = lookback;
+
+ // draw chart
+ DrawPageViewTimeChart();
+ pageNowPlaying = setInterval(DrawPageViewTimeChart, 60 * 1000);
+}
+
+function handleUrlChange()
+{
+ var page = document.getElementById('page').value;
+ if ((page == "home")||(page == "contact")||(page == "about")||(page == "support") || (page =="all"))
+ {
+ document.getElementById('index').value = 0;
+ document.getElementById('index').disabled = "true";
+ } else {
+ document.getElementById('index').value = 0;
+ document.getElementById('index').disabled = "";
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/PageViewTimeData.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/PageViewTimeData.php b/apps/logstream/src/main/html/PageViewTimeData.php
new file mode 100644
index 0000000..7c42679
--- /dev/null
+++ b/apps/logstream/src/main/html/PageViewTimeData.php
@@ -0,0 +1,109 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(1);
+$format = 'YmdHi';
+$incr = 60;
+
+// Get from date
+$from = $_GET['from'];
+if (!$from || empty($from)) {
+ $from = time()-3600;
+}
+
+// get url
+$url = $_GET['url'];
+
+// result array
+$result = array();
+
+while ($from < time())
+{
+ $date = gmdate($format, $from);
+ if (!$url || empty($url))
+ {
+ // view total
+ $total = 0;
+
+ // home.php views
+ $key = 'm|' . $date . '|0:mydomain.com/home.php';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+
+ // contactus.php views
+ $key = 'm|' . $date . '|0:mydomain.com/contactus.php';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+
+ // contactus.php views
+ $key = 'm|' . $date . '|0:mydomain.com/about.php';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+
+ // contactus.php views
+ $key = 'm|' . $date . '|0:mydomain.com/support.php';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+
+ // products.php
+ for ($i = 0; $i < 100; $i++)
+ {
+ $key = 'm|' . $date . '|0:mydomain.com/products.php?productid='. $i;
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ }
+
+ // services.php
+ for ($i = 0; $i < 100; $i++)
+ {
+ $key = 'm|' . $date . '|0:mydomain.com/services.php?serviceid='. $i;
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ }
+
+ // partners.php
+ for ($i = 0; $i < 100; $i++)
+ {
+ $key = 'm|' . $date . '|0:mydomain.com/partners.php?partnerid='. $i;
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ }
+
+ // store result in array
+ $result[] = array("timestamp" => $from * 1000, "url" => "all", "view" => $total);
+
+ } else {
+
+ $key = 'm|' . $date . '|0:' . $url;
+ $arr = $redis->hGetAll($key);
+ if ($arr)
+ {
+ $result[] = array("timestamp" => $from * 1000, "url" => $url, "view" => $arr[1]);
+ }
+ }
+ $from += $incr;
+}
+
+array_pop($result);
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/Server404.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/Server404.php b/apps/logstream/src/main/html/Server404.php
new file mode 100644
index 0000000..314d5e9
--- /dev/null
+++ b/apps/logstream/src/main/html/Server404.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(8);
+
+// result array
+$result = array();
+
+for($i = 0; $i < 10; $i++)
+{
+ $value = $redis->get($i);
+ //var_dump($value);
+ $result[] = $value;
+}
+
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/ServerLoad.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/ServerLoad.php b/apps/logstream/src/main/html/ServerLoad.php
new file mode 100644
index 0000000..d2f4dca
--- /dev/null
+++ b/apps/logstream/src/main/html/ServerLoad.php
@@ -0,0 +1,100 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(4);
+$format = 'YmdHi';
+$incr = 60;
+
+// Get from date
+$from = $_GET['from'];
+if (!$from || empty($from)) {
+ $from = time()-3600;
+}
+
+// get server
+$server = $_GET['server'];
+
+// result array
+$result = array();
+
+while ($from < time())
+{
+ $date = gmdate($format, $from);
+ if (!$server || empty($server) || ($server == "all"))
+ {
+ // total server load
+ $total = 0;
+
+ // server loads
+ $key = 'm|' . $date . '|0:server0.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server1.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server2.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server3.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server4.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server5.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server6.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server7.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server8.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+ $key = 'm|' . $date . '|0:server9.mydomain.com:80';
+ $arr = $redis->hGetAll($key);
+ $total += $arr[1];
+
+ // add to result
+
+ // add to result
+ $result[] = array("timestamp" => $from * 1000, "server" => "all", "view" => $total);
+
+ } else {
+
+ $key = 'm|' . $date . '|0:' . $server;
+ $arr = $redis->hGetAll($key);
+ if ($arr)
+ {
+ $result[] = array("timestamp" => $from * 1000, "server" => $server, "view" => $arr[1]);
+ }
+ }
+ $from += $incr;
+}
+
+array_pop($result);
+print json_encode($result);
+
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopIpClientChart.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopIpClientChart.js b/apps/logstream/src/main/html/TopIpClientChart.js
new file mode 100644
index 0000000..ee1a0c8
--- /dev/null
+++ b/apps/logstream/src/main/html/TopIpClientChart.js
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top IpClient table.
+ */
+
+function DrawTopIpClientTableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ var pts = JSON.parse(data);
+ topIpClientTable = new google.visualization.DataTable();
+ topIpClientTable.addColumn('string', 'Client IP');
+ topIpClientTable.addColumn('number', 'requests/sec');
+ topIpClientTable.addRows(10);
+ for(var i=0; (i < pts.length)&&(i < 10); i++)
+ {
+ var row = pts[i].split("##");
+ topIpClientTable.setCell(i, 0, row[0]);
+ topIpClientTable.setCell(i, 1, parseInt(row[1]));
+ delete row
+ delete pts[i];
+ }
+ topIpClientTableChart.draw(topIpClientTable, {showRowNumber: true});
+ delete topIpClientTable;
+ delete data;
+ delete pts;
+ //document.getElementById('top_IpClient_div').innerHTML = data;
+ }
+ }
+ connect.open('GET', "TopIpClientData.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopIpClientData.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopIpClientData.php b/apps/logstream/src/main/html/TopIpClientData.php
new file mode 100644
index 0000000..ddb644d
--- /dev/null
+++ b/apps/logstream/src/main/html/TopIpClientData.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(3);
+
+// result array
+$result = array();
+
+for($i = 0; $i < 10; $i++)
+{
+ $value = $redis->get($i);
+ //var_dump($value);
+ $result[] = $value;
+}
+
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopIpData.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopIpData.js b/apps/logstream/src/main/html/TopIpData.js
new file mode 100644
index 0000000..e6f7f67
--- /dev/null
+++ b/apps/logstream/src/main/html/TopIpData.js
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top url table.
+ */
+
+function DrawRiskyClientTableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ var pts = JSON.parse(data);
+ var riskyCleintTable = new google.visualization.DataTable();
+ riskyCleintTable.addColumn('string', 'Client Ip');
+ riskyCleintTable.addColumn('number', 'bytes/sec');
+ riskyCleintTable.addRows(10);
+ for(var i=0; (i < pts.length)&&(i < 10); i++)
+ {
+ var row = pts[i].split("##");
+ riskyCleintTable.setCell(i, 0, row[0]);
+ riskyCleintTable.setCell(i, 1, parseInt(row[1]));
+ }
+ //document.getElementById('risky_client_div').innerHTML = data;
+ //document.getElementById('risky_client_div').innerHTML = riskyCleintTable.getNumberOfRows();
+ riskyClientTableChart.draw(riskyCleintTable, {showRowNumber: true});
+ delete riskyCleintTable;
+ delete data;
+ delete pts;
+ }
+ }
+ connect.open('GET', "TopIpData.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopIpData.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopIpData.php b/apps/logstream/src/main/html/TopIpData.php
new file mode 100644
index 0000000..ce07ad8
--- /dev/null
+++ b/apps/logstream/src/main/html/TopIpData.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(6);
+
+// result array
+$result = array();
+
+for($i = 0; $i < 10; $i++)
+{
+ $value = $redis->get($i);
+ $result[] = $value;
+}
+
+print json_encode($result);
+
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopServer.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopServer.js b/apps/logstream/src/main/html/TopServer.js
new file mode 100644
index 0000000..b94a876
--- /dev/null
+++ b/apps/logstream/src/main/html/TopServer.js
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top url table.
+ */
+
+function DrawTopServerTableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ var pts = JSON.parse(data);
+ topServerTable = new google.visualization.DataTable();
+ topServerTable.addColumn('string', 'SERVER');
+ topServerTable.addColumn('number', 'requests/sec');
+ topServerTable.addRows(10);
+ for(var i=0; (i < pts.length)&&(i < 10); i++)
+ {
+ var row = pts[i].split("##");
+ topServerTable.setCell(i, 0, row[0]);
+ topServerTable.setCell(i, 1, parseInt(row[1]));
+ delete pts[i];
+ }
+ topServerTableChart.draw(topServerTable, {showRowNumber: true});
+ delete topServerTable;
+ delete data;
+ delete pts;
+ }
+ }
+ connect.open('GET', "TopServer.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopServer.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopServer.php b/apps/logstream/src/main/html/TopServer.php
new file mode 100644
index 0000000..91bfab5
--- /dev/null
+++ b/apps/logstream/src/main/html/TopServer.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(10);
+
+// result array
+$result = array();
+
+for($i = 0; $i < 10; $i++)
+{
+ $value = $redis->get($i);
+ //var_dump($value);
+ $result[] = $value;
+}
+
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopUrlChart.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopUrlChart.js b/apps/logstream/src/main/html/TopUrlChart.js
new file mode 100644
index 0000000..646bb69
--- /dev/null
+++ b/apps/logstream/src/main/html/TopUrlChart.js
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top url table.
+ */
+
+function DrawTopUrlTableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ var pts = JSON.parse(data);
+ topUrlTable = new google.visualization.DataTable();
+ topUrlTable.addColumn('string', 'URL');
+ topUrlTable.addColumn('number', 'requests/sec');
+ topUrlTable.addRows(10);
+ for(var i=0; (i < pts.length)&&(i < 10); i++)
+ {
+ var row = pts[i].split("##");
+ topUrlTable.setCell(i, 0, row[0]);
+ topUrlTable.setCell(i, 1, parseInt(row[1]));
+ delete pts[i];
+ }
+ topUrlTableChart.draw(topUrlTable, {showRowNumber: true});
+ delete topUrlTable;
+ delete data;
+ delete pts;
+ }
+ }
+ connect.open('GET', "TopUrlData.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TopUrlData.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TopUrlData.php b/apps/logstream/src/main/html/TopUrlData.php
new file mode 100644
index 0000000..52c3ddf
--- /dev/null
+++ b/apps/logstream/src/main/html/TopUrlData.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(2);
+
+// result array
+$result = array();
+
+for($i = 0; $i < 20; $i++)
+{
+ $value = $redis->get($i);
+ //var_dump($value);
+ $result[] = $value;
+}
+
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TotalViews.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TotalViews.js b/apps/logstream/src/main/html/TotalViews.js
new file mode 100644
index 0000000..58ecf7e
--- /dev/null
+++ b/apps/logstream/src/main/html/TotalViews.js
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top url table.
+ */
+
+function DrawTotalViewsTableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ document.getElementById('totalviews').innerHTML = data;
+ }
+ }
+ connect.open('GET', "TotalViews.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/TotalViews.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/TotalViews.php b/apps/logstream/src/main/html/TotalViews.php
new file mode 100644
index 0000000..178cb9b
--- /dev/null
+++ b/apps/logstream/src/main/html/TotalViews.php
@@ -0,0 +1,27 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(11);
+
+$value = $redis->get(1);
+print $value;
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/Url404.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/Url404.js b/apps/logstream/src/main/html/Url404.js
new file mode 100644
index 0000000..faa1734
--- /dev/null
+++ b/apps/logstream/src/main/html/Url404.js
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Functions fro charting top url table.
+ */
+
+function DrawUrl404TableChart()
+{
+ try
+ {
+ var connect = new XMLHttpRequest();
+ connect.onreadystatechange = function() {
+ if(connect.readyState==4 && connect.status==200) {
+ var data = connect.response;
+ var pts = JSON.parse(data);
+ var url404Table = new google.visualization.DataTable();
+ url404Table.addColumn('string', 'URL');
+ url404Table.addColumn('number', '404/sec');
+ url404Table.addRows(10);
+ for(var i=0; ((i < pts.length)&&(i < 10)); i++)
+ {
+ var row = pts[i].split("##");
+ if ((row[1] == null)||(row[1] == ""))
+ {
+ url404Table.setCell(i, 0, "-");
+ } else {
+ url404Table.setCell(i, 0, row[0]);
+ }
+ if ((row[1] == null)||(row[1] == ""))
+ {
+ url404Table.setCell(i, 1, 0);
+ } else {
+ url404Table.setCell(i, 1, parseInt(row[1]));
+ }
+ }
+ //document.getElementById('risky_client_div').innerHTML = data;
+ //document.getElementById('risky_client_div').innerHTML = url404Table.getNumberOfRows();
+ url404TableChart.draw(url404Table, {showRowNumber: true});
+ delete url404Table;
+ delete data;
+ delete pts;
+ }
+ }
+ connect.open('GET', "Url404.php", true);
+ connect.send(null);
+ } catch(e) {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/Url404.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/Url404.php b/apps/logstream/src/main/html/Url404.php
new file mode 100644
index 0000000..82067f8
--- /dev/null
+++ b/apps/logstream/src/main/html/Url404.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+header("Content-type: application/json");
+$redis = new Redis();
+$redis->connect('127.0.0.1');
+$redis->select(7);
+
+// result array
+$result = array();
+
+for($i = 0; $i < 10; $i++)
+{
+ $value = $redis->get($i);
+ //var_dump($value);
+ $result[] = $value;
+}
+
+print json_encode($result);
+
+?>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/global.js
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/global.js b/apps/logstream/src/main/html/global.js
new file mode 100644
index 0000000..7555f39
--- /dev/null
+++ b/apps/logstream/src/main/html/global.js
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * Declaration and initialization for global variables.
+ */
+
+// url parameters
+var params;
+
+// Page View/Time
+var pageViewData;
+var pageDataPoints;
+var pageViewTable;
+var pageViewChart;
+var PageViewView;
+var pageViewRefresh;
+var pageViewLookback;
+var pageViewUrl;
+var pageViewInterval;
+var pageNowPlaying;
+
+// top url(s)
+var topUrlTable;
+var topUrlTableChart;
+
+// server load
+var serverLoadRefresh;
+var serverLoadLookback;
+var serverName;
+var serverLoadDataPoints;
+var serverLoadTable;
+var serverLoadChart;
+var serverLoadView;
+var serverLoadInterval;
+
+// Top server(s)
+var topServerTable;
+var topServerTableChart;
+
+var topIpClientTable;
+var topIpClientTableChart;
+var riskyClientTableChart;
+var url404TableChart;
+var server404TableChart;
+var serverNowPlaying;
+
+
+// Get split query string
+function QueryString() {
+ var query_string = {};
+ var query = window.location.search.substring(1);
+ return query;
+}
+function SplitQuery(query)
+{
+ var params = {};
+ var vars = query.split("&");
+ for (var i=0;i<vars.length;i++)
+ {
+ var pair = vars[i].split("=");
+ if(pair.length == 2)
+ {
+ params[pair[0]] = pair[1];
+ }
+ }
+ return params;
+}
+
+// Initialize global variable(s)
+function InitializeGlobal()
+{
+ // Initialize params
+ params = SplitQuery(QueryString());
+
+ // intialize page view variables
+ pageDataPoints = new Array();
+ pageViewTable = new google.visualization.DataTable();
+ pageViewTable.addColumn('datetime', 'Time');
+ pageViewTable.addColumn('number', 'Page View');
+ pageViewChart = new google.visualization.LineChart(document.getElementById('pageview_chart_div'));
+ PageViewView = new google.visualization.DataView(pageViewTable);
+ pageViewRefresh = 60;
+ pageViewLookback = (new Date().getTime()/1000) - 3600;
+ document.getElementById('pageviewlookback').value = "1";
+ pageViewInterval = 1;
+
+ serverLoadRefresh = 60;
+ serverLoadLookback = (new Date().getTime()/1000) - 3600;
+ document.getElementById('serverloadlookback').value = "1";
+ serverLoadDataPoints = new Array();
+ serverLoadTable = new google.visualization.DataTable();
+ serverLoadTable.addColumn('datetime', 'Time');
+ serverLoadTable.addColumn('number', 'Server Load');
+ serverLoadChart = new google.visualization.LineChart(document.getElementById('server_load_div'));
+ serverLoadView = new google.visualization.DataView(serverLoadTable);
+ serverLoadInterval = 1;
+
+ topUrlTableChart = new google.visualization.Table(document.getElementById('top_url_div'));
+ topServerTableChart = new google.visualization.Table(document.getElementById('top_server_div'));
+
+ topIpClientTableChart = new google.visualization.Table(document.getElementById('top_IpClient_div'));
+ riskyClientTableChart = new google.visualization.Table(document.getElementById('top_ipdata_div'));
+
+ url404TableChart = new google.visualization.Table(document.getElementById('url_404_div'));
+ server404TableChart = new google.visualization.Table(document.getElementById('server_404_div'));
+}
+
+/**
+ * Sort json array
+ */
+function sortByKey(array, key) {
+ return array.sort(function(a, b) {
+ var x = a[key]; var y = b[key];
+ return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ });
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/index.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/index.php b/apps/logstream/src/main/html/index.php
new file mode 100644
index 0000000..3db53bc
--- /dev/null
+++ b/apps/logstream/src/main/html/index.php
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+<!--
+ -- Copyright (c) 2012-2013 DataTorrent, Inc.
+ -- All Rights Reserved.
+ -->
+
+<!-- ## Siteops is deprecated, please use logstream instead ## -->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Data Torrent : Site Operations Demo </title>
+
+<link rel="stylesheet" type="text/css" href="malhar.css">
+
+<!-- Google charts include -->
+<script type="text/javascript" src="https://www.google.com/jsapi"></script>
+<script type="text/javascript">
+google.load('visualization', '1', {'packages':['corechart']});
+google.load('visualization', '1', {'packages':['table']});
+
+</script>
+
+<!-- DataTorrent charting utils -->
+<script type="text/javascript" src="global.js"></script>
+<script type="text/javascript" src="DrawPageViewTimeChart.js"></script>
+<script type="text/javascript" src="TopUrlChart.js"></script>
+<script type="text/javascript" src="TopServer.js"></script>
+<script type="text/javascript" src="TopIpClientChart.js"></script>
+<script type="text/javascript" src="server.js"></script>
+<script type="text/javascript" src="TopIpData.js"></script>
+<script type="text/javascript" src="TotalViews.js"></script>
+<script type="text/javascript" src="Url404.js"></script>
+<script type="text/javascript" src="ClientData.js"></script>
+<script type="text/javascript" src="serverfail.js"></script>
+<script type="text/javascript" src="TotalViews.js"></script>
+
+<!-- window onload -->
+<script type="text/javascript">
+
+window.onload = function() {
+
+ // Initialize variables
+ InitializeGlobal();
+
+ // Draw top charts
+ DrawClientDataTableChart();
+ DrawTotalViewsTableChart();
+ DrawTopUrlTableChart();
+ DrawTopServerTableChart();
+ DrawRiskyClientTableChart();
+ DrawTopIpClientTableChart();
+ DrawUrl404TableChart();
+ DrawServer404TableChart();
+ setInterval(DrawClientDataTableChart, 1000)
+ setInterval(DrawTotalViewsTableChart, 1000);
+ setInterval(DrawTopUrlTableChart, 1000);
+ setInterval(DrawTopServerTableChart, 1000);
+ setInterval(DrawRiskyClientTableChart, 1000);
+ setInterval(DrawTopIpClientTableChart, 1000);
+ setInterval(DrawUrl404TableChart, 1000);
+ setInterval(DrawServer404TableChart, 1000);
+};
+
+</script>
+
+</head>
+<body>
+
+ <div id="header">
+ <ul class="dashboard-modes">
+ <li>
+ <a href="#" class="active">Site Operations Demo</a>
+ </li>
+ </ul>
+
+ </div>
+
+ <div id="main">
+ <div id="pagecontent">
+ <div class="dashboardMgr">
+ <div class="inner" style="">
+ <h2 class="title">Page views vs Time Chart</h2>
+ <form onsubmit="return false;">
+ Select Page:
+ <select name="page" id="page" style="width:200px;" onchange="handleUrlChange();">
+ <option value="all">ALL</option>
+ <option value="home">home.php</option>
+ <option value="contact">contactus.php</option>
+ <option value="about">about.php</option>
+ <option value="support">support.php</option>
+ <option value="product">products.php</option>
+ <option value="services">services.php</option>
+ <option value="partners">partners.php</option>
+ </select><br>
+ Product/Services/Partners Index :
+ <select name="index" id="index" style="width:200px;" disabled="true" >
+ <option value=\"$i\"></option>
+ <?php
+ for ($i = 0; $i < 100; $i++) {
+ print "<option value=\"$i\">$i</option>\n";
+ }
+ ?>
+ </select><br>
+ Look Back(Hours):
+ <input type="text" name="lookback" id="pageviewlookback" class="input-small"/>
+ </form><br>
+ <a href="javascript:void(0)" onclick="HandlePageViewTimeSubmit();">View Chart</a><br><br>
+
+ <h2 class="title">Server Load vs Time Chart</h2>
+ <form onsubmit="return false;">
+ Server Name :
+ <select name="servername" id="servername" style="width:200px;">
+ <option value="all">All</option>
+ <?php
+ for ($i = 0; $i < 10; $i++) {
+ print "<option value=\"server{$i}.mydomain.com:80\">Server$i.mydomain.com</option>\n";
+ }
+ ?>
+ </select><br>
+ Server Load Look Back(Hours):
+ <input type="text" name="serverloadlookback" id="serverloadlookback" class="input-small"/>
+ </form><br>
+ <a href="javascript:void(0)" onclick="HandleServerLoadTimeSubmit();">View Server Load Chart</a><br><br>
+
+ <b>Total Bytes/Sec :</b> <b id="totaldata"> </b> <br
+ <b>Total Views/Sec :</b> <b id="totalviews"> </b>
+ </div>
+ </div>
+ <div class="dashboardMain">
+ <div class="dbib">
+ <div id="pageview_chart_div"></div>
+ <div id="server_load_div"></div>
+ </div>
+ <div class="dbib">
+ <table><tbody><tr>
+
+ <td> <h1>Top 10 Urls</h1>
+ <div id="top_url_div" ></div><br><br>
+ <h1>Top 10 Client IPs</h1>
+ <div id="top_IpClient_div"></div> <br><br>
+ <h1>Top 10 Urls with 404 response</h1>
+ <div id="url_404_div"></div>
+ </td>
+ <td>
+ <h1>Server Load</h1>
+ <div id="top_server_div"></div> <br><br>
+ <h1>Top 10 client IPs download</h1>
+ <div id="top_ipdata_div"></div> <br><br>
+ <h1>404 per Server</h1>
+ <div id="server_404_div"></div-->
+ </td>
+
+ </tr></tbody></table>
+ </div>
+ </div>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-apex-malhar/blob/f0863913/apps/logstream/src/main/html/info.php
----------------------------------------------------------------------
diff --git a/apps/logstream/src/main/html/info.php b/apps/logstream/src/main/html/info.php
new file mode 100644
index 0000000..adc6a88
--- /dev/null
+++ b/apps/logstream/src/main/html/info.php
@@ -0,0 +1,22 @@
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+phpinfo();
+
+?>
\ No newline at end of file