diff --git a/js/lib/ltmLogParser.js b/js/lib/ltmLogParser.js
new file mode 100644
index 0000000..e081380
--- /dev/null
+++ b/js/lib/ltmLogParser.js
@@ -0,0 +1,152 @@
+
+
+function startLTMLogFetcher(){
+
+ //Check if the database contains anything
+ if(typeof(logDatabase) === "undefined"){
+ var rawData = localStorage.getItem("ltmLog") || "{\"content\":{},\"lastSynced\":null}";
+ logDatabase = JSON.parse(rawData);
+ //updateLTMLogStatistics(getLTMLogStatisticsSummary(logDatabase));
+ initiateLTMLogStatistics();
+ }
+
+ if(logDatabase.lastSynced){
+ var lastSynced = new Date(logDatabase.lastSynced);
+ var now = new Date();
+ var seconds = (now.getTime() - lastSynced.getTime()) / 1000;
+ }
+
+ var fetchLTMLog = function(){
+ $.ajax({
+ url: "https://" + window.location.host + "/tmui/Control/jspmap/tmui/system/log/list_ltm.jsp",
+ type: "GET",
+ success: function(response) {
+ $(response).find("table.list tbody tr").each(function(){
+
+ var message = {}
+
+ var row = $(this).find("td");
+
+ message.timeStamp = $(row[0]).text().trim();
+ message.logLevel = $(row[1]).text().trim();
+ message.host = $(row[2]).text().trim();
+ message.service = $(row[3]).text().trim();
+ message.statusCode = $(row[4]).text().trim();
+ message.logEvent = $(row[5]).text().trim();
+
+ var data = "";
+ for(var i in message){
+ data += message[i]
+ }
+
+ if(!(data in logDatabase)){
+ logDatabase.content[data] = message
+ }
+
+ logDatabase.lastSynced = new Date();
+ })
+
+ updateLTMLogStatistics(getLTMLogStatisticsSummary(logDatabase));
+ localStorage.setItem("ltmLog", JSON.stringify(logDatabase));
+ }
+
+ })
+ }
+
+ fetchLTMLog();
+ setInterval(fetchLTMLog, ltmLogCheckInterval*1000);
+ }
+
+ function initiateLTMLogStatistics(){
+
+ var topFrame = $(parent.top.document);
+
+ if(topFrame.find("div.ltmLogStats").length == 0){
+
+ var styleTag = $(``);
+
+ topFrame.find('html > head').append(styleTag);
+ var html = ``;
+
+ var parameterList = [];
+
+ for(var i in ltmLogPatterns){
+
+ if(parameterList.length == 2){
+ html += `
` + parameterList.join("") + `
`
+ parameterList = [];
+ }
+
+ parameterList.push(`
+
+
+ Loading...
+
`
+ );
+ }
+
+ if(parameterList.length != 0){
+ html += `` + parameterList.join("") + `
`
+ }
+
+ topFrame.find("div#userinfo").last().after(html);
+
+ }
+
+ }
+
+ function updateLTMLogStatistics(summary){
+
+ var topFrame = $(parent.top.document);
+
+ if(topFrame.find("div.ltmLogStats").length != 0){
+
+ var i = 0
+ for(var stats in summary){
+ var statsSpan = topFrame.find("div#logStats" + stats + " span");
+ statsSpan.fadeOut(300);
+ statsSpan.html(summary[stats]);
+ statsSpan.fadeIn(300);
+ }
+
+ }
+
+ }
+
+ function getLTMLogStatisticsSummary(logDatabase){
+
+ var summary = {};
+ var events = logDatabase.content;
+
+ for(var f in ltmLogPatterns){
+ var logTest = ltmLogPatterns[f];
+ if(logTest.enabled){
+ summary[f] = 0;
+ }
+ }
+
+ for(var i in events){
+
+ var event = events[i];
+
+ for(functionName in ltmLogPatterns){
+
+ var f = ltmLogPatterns[functionName];
+ if(f.isMatching(event)){
+ summary[functionName]++;
+ }
+ }
+
+ }
+
+ return(summary);
+
+ }
+
\ No newline at end of file
diff --git a/js/main.js b/js/main.js
index 601f9ef..588650f 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,194 +1,3 @@
-/***************************************************************************************
- Begin Config section
-****************************************************************************************/
-
- /**************************************************************
- How many rules you want to see in the rule assignment window
- Default:
- iRulesCount = 40;
- ***************************************************************/
-
- var iRulesCount = 40;
-
- /**************************************************************
- How many monitors you want to show in the monitor selection
- Default:
- MonitorCount = 30;
- ***************************************************************/
-
- var MonitorCount = 30;
-
- /**************************************************************
- How many data group list entries to show
- Default:
- DatagroupListCount = 30;
- ***************************************************************/
-
- var DatagroupListCount = 30;
-
- /**************************************************************
- Set http monitor name default suffix
- Default:
- HttpMonitorSuffix = "";
- ***************************************************************/
- var HttpMonitorSuffix = "-http_monitor";
-
- /**************************************************************
- Set the default pool name
- Default:
- DefaultPoolName = "";
- ***************************************************************/
- var DefaultPoolName = "-[port]_pool";
-
- /**************************************************************
- Set the default action on pool down when creating pools
- Default:
- DefaultActionOnPoolDown = 0;
- Options:
- 0 = None
- 1 = Reject
- 2 = Drop
- ***************************************************************/
-
- var DefaultActionOnPoolDown = 1;
-
- /**************************************************************
- Set the default action on pool down when creating pools
- Default = 0;
- Options:
- 0 = Round Robin
- 1 = Ratio (member)
- 2 = Least Connections (member)
- 3 = Observed (member)
- 4 = Predictive (member)
- 5 = Ratio (node)
- 6 = Least connections (node)
- 7 = Fastest (node)
- 8 = Observed (node)
- 9 = Predictive (node)
- 10 = Dynamic Ratio (node)
- 11 = Fastest (application)
- 12 = Least sessions
- 13 = Dynamic ratio (member)
- 14 = Weighted Least Connections (member)
- 15 = Weighted Least Connections (node)
- 16 = Ratio (session)
- 17 = Ratio Least connections (member)
- 18 = Ratio Least connections (node)
- **************************************************************/
-
- var DefaultLBMethod = 4;
-
- /**************************************************************
- Choose Node List as default when creating pools
- Default:
- ChooseNodeAsDefault = 0;
- Options:
- 0 = No
- 1 = Yes
- **************************************************************/
- var ChooseNodeAsDefault = 1;
-
- /**************************************************************
- Add default certificate signing alternatives
- First one defined is always the default one
- This one is a bit tricky to format, look at the example carefully
- Options:
- false = No
- true = Yes
- Example that creates two options:
- var csroptions = {
- Company1: {
- OptionName: 'Company 1',
- CommonName: '[Example *.domain.com]',
- Division: 'Stockholm office',
- Organization: 'My Office address',
- Locality: 'Stockholm',
- StateProvince: 'Stockholm',
- Country: 'SE',
- Email: 'office@company.se',
- SubjectAlt: ''
- }
- ,
- Company2: {
- OptionName: 'Another company',
- CommonName: '[Example *.domain.com]',
- Division: 'Oslo office',
- Organization: 'My Oslo Office address',
- Locality: 'Oslo',
- StateProvince: 'Oslo',
- Country: 'NO',
- Email: 'office@company.no',
- SubjectAlt: ''
- }
- }
- **************************************************************/
-
- var csroptions = {
- "Company1": {
- "OptionName": "Company 1",
- "CommonName": "[Example *.domain.com]",
- "Division": "Stockholm office",
- "Organization": "My Office address",
- "Locality": "Stockholm",
- "StateProvince": "Stockholm",
- "Country": "SE",
- "Email": "office@company.se",
- "SubjectAlt": ""
- }
- ,
- "Company2": {
- "OptionName": "Another company",
- "CommonName": "[Example *.domain.com]",
- "Division": "Oslo office",
- "Organization": "My Oslo Office address",
- "Locality": "Oslo",
- "StateProvince": "Oslo",
- "Country": "NO",
- "Email": "office@company.no",
- "SubjectAlt": ""
- }
- }
-
- /*****************************************************************************
- Select this default chain certificate when creating client SSL profiles
- Default:
- defaultChain = "";
- defaultChain = "/Common/mychain.crt";
- *******************************************************************************/
-
- var defaultChain = "/Common/ca-bundle.crt";
-
- /*************************************************************************
- Chooses a default parent profile when creating client SSL profiles
- Default:
- defaultClientSSLParentProfile = "";
- defaultClientSSLParentProfile = "/Common/myParentProfile";
- ***************************************************************************/
-
- var defaultClientSSLParentProfile = "";
-
- /*************************************************************************
- Deactivate the choice to activate the Christmas theme altogether
- Default (allow the choice):
- allowChristmas = false;
- Don't allow the choice:
- allowChristmas = true;
- ***************************************************************************/
-
- var allowChristmas = true;
-
- /**************************************************************************
- How often should the script update the LTM log stats (in seconds)
- ltmLogCheckInterval = 30;
- **************************************************************************/
-
- var ltmLogCheckInterval = 30;
-
-/***************************************************************************************
- End Config section
-****************************************************************************************/
-
//Make sure that the tampermonkey jQuery does not tamper with F5's scripts
this.$ = this.jQuery = jQuery.noConflict(true);
@@ -624,157 +433,6 @@ String.prototype.hashCode = function(){
-function startLTMLogFetcher(){
-
- //Check if the database contains anything
- if(typeof(logDatabase) === "undefined"){
- var rawData = localStorage.getItem("ltmLog") || "{\"content\":{},\"lastSynced\":null}";
- logDatabase = JSON.parse(rawData);
- //updateLTMLogStatistics(getLTMLogStatisticsSummary(logDatabase));
- initiateLTMLogStatistics();
- }
-
- if(logDatabase.lastSynced){
- var lastSynced = new Date(logDatabase.lastSynced);
- var now = new Date();
- var seconds = (now.getTime() - lastSynced.getTime()) / 1000;
- }
-
- var fetchLTMLog = function(){
- $.ajax({
- url: "https://" + window.location.host + "/tmui/Control/jspmap/tmui/system/log/list_ltm.jsp",
- type: "GET",
- success: function(response) {
- $(response).find("table.list tbody tr").each(function(){
-
- var message = {}
-
- var row = $(this).find("td");
-
- message.timeStamp = $(row[0]).text().trim();
- message.logLevel = $(row[1]).text().trim();
- message.host = $(row[2]).text().trim();
- message.service = $(row[3]).text().trim();
- message.statusCode = $(row[4]).text().trim();
- message.logEvent = $(row[5]).text().trim();
-
- var data = "";
- for(var i in message){
- data += message[i]
- }
-
- if(!(data in logDatabase)){
- logDatabase.content[data] = message
- }
-
- logDatabase.lastSynced = new Date();
- })
-
- updateLTMLogStatistics(getLTMLogStatisticsSummary(logDatabase));
- localStorage.setItem("ltmLog", JSON.stringify(logDatabase));
- }
-
- })
- }
-
- fetchLTMLog();
- setInterval(fetchLTMLog, ltmLogCheckInterval*1000);
-}
-
-function initiateLTMLogStatistics(){
-
- var topFrame = $(parent.top.document);
-
- if(topFrame.find("div.ltmLogStats").length == 0){
-
- var styleTag = $(``);
-
- topFrame.find('html > head').append(styleTag);
- var html = ``;
-
- var parameterList = [];
-
- for(var i in ltmLogPatterns){
-
- if(parameterList.length == 2){
- html += `` + parameterList.join("") + `
`
- parameterList = [];
- }
-
- parameterList.push(`
-
-
- Loading...
-
`
- );
- }
-
- if(parameterList.length != 0){
- html += `` + parameterList.join("") + `
`
- }
-
- topFrame.find("div#userinfo").last().after(html);
-
- }
-
-}
-
-function updateLTMLogStatistics(summary){
-
- var topFrame = $(parent.top.document);
-
- if(topFrame.find("div.ltmLogStats").length != 0){
-
- var i = 0
- for(var stats in summary){
- var statsSpan = topFrame.find("div#logStats" + stats + " span");
- statsSpan.fadeOut(300);
- statsSpan.html(summary[stats]);
- statsSpan.fadeIn(300);
- }
-
- }
-
-}
-
-function getLTMLogStatisticsSummary(logDatabase){
-
- var summary = {};
- var events = logDatabase.content;
-
- for(var f in ltmLogPatterns){
- var logTest = ltmLogPatterns[f];
- if(logTest.enabled){
- summary[f] = 0;
- }
- }
-
- for(var i in events){
-
- var event = events[i];
-
- for(functionName in ltmLogPatterns){
-
- var f = ltmLogPatterns[functionName];
- if(f.isMatching(event)){
- summary[functionName]++;
- }
- }
-
- }
-
- return(summary);
-
-}
-
-
function addPartitionFilter(){
diff --git a/manifest.json b/manifest.json
index c6dc520..09df6d5 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name": "ADC Tweaks",
- "version": "0.0.0.1",
+ "version": "0.0.0.2",
"description": "Tweaks for the F5 Web Interface",
"permissions": ["activeTab", "storage"],
"short_name": "ADCTweaks",
@@ -13,6 +13,7 @@
"js/lib/balloon.js",
"js/lib/waitForStorageKey.js",
"js/lib/christmas.js",
+ "js/lib/ltmLogParser.js",
"js/lib/getStorage.js",
"js/main.js"
],