doctype html include includes/head.pug body include includes/navigation.pug .container-fluid .row.page-container .col-md-12.col-sm-12.col-xs-12 .row .col .container-fluid .tab button(class="tablinks" onclick="openTab(event, 'Details')") Details button(class="tablinks hidden" onclick="openTab(event, 'Tasks')") Tasks button(class="tablinks" onclick="openTab(event, 'Options')") Options button(class="tablinks hidden" onclick="openTab(event, 'Errors')") Errors button(class="tablinks hidden" onclick="openTab(event, 'Exceptions')") Exceptions button(class="tablinks hidden" onclick="openTab(event, 'Warnings')") Warnings button(class="tablinks" onclick="openTab(event, 'Full')") Full log #Details(class="tabcontent default") h3 Details #Tasks(class="tabcontent") h3 Tasks #Options(class="tabcontent") h3 Options #Errors(class="tabcontent") h3 Errors #Exceptions(class="tabcontent") h3 Exceptions #Warnings(class="tabcontent") h3 Warnings #Full(class="tabcontent") h3 Full log .row .col.croppie .container-fluid #content script. var file = !{JSON.stringify(files.logfile.path)} var data = !{JSON.stringify(data)} var jobType = !{JSON.stringify(jobtype)} var details = document.getElementById('Details'); var tasks = document.getElementById('Tasks'); var options = document.getElementById('Options'); var errors = document.getElementById('Errors'); var exceptions = document.getElementById('Exceptions'); var warnings = document.getElementById('Warnings'); var content = document.getElementById('Full'); var alldata = { 'Clients': [], 'Job status': {}, 'Tasks': {}, 'Warnings': [], 'Errors': [], 'Exceptions': [], 'Job globals': [], 'Job options': [], 'Node options': {} } data.forEach(function(line, idx) { checkVersion(line); checkJobType(line); checkJobGlobals(line); checkJobGlobalOptions(line); checkJobOptions(line); checkCompletitionStatus(line); checkTasks(line); getClientName(line); findWarnings(line); findErrors(line); findExceptions(line); writeLog(line, idx + 1); }) // write to tabs if (Object.entries(alldata['Clients']).length > 0) { details.insertAdjacentHTML('beforeend', '
' + alldata['Clients'][i] + ' - ' + [i] + '
') } } if (Object.entries(alldata['Job status']).length > 0) { details.insertAdjacentHTML('beforeend', 'Completition status: ' + alldata['Job status']['Status'] + '
') } else { details.insertAdjacentHTML('beforeend', 'Completition status: ' + alldata['Job status']['Status'] + '
') } details.insertAdjacentHTML('beforeend', 'Run time: ' + alldata['Job status']['Run time'] + '
') details.insertAdjacentHTML('beforeend', 'Data volume: ' + alldata['Job status']['Data volume'] + '
') details.insertAdjacentHTML('beforeend', 'Throughput: ' + alldata['Job status']['Throughput'] + '
') details.insertAdjacentHTML('beforeend', 'Transfer rate: ' + alldata['Job status']['Transfer rate'] + '
') } if (Object.entries(alldata['Tasks']).length > 0) { Object.entries(alldata['Tasks']).forEach(function(el) { var status = parseInt(el[1]["Status"]); var bg = "#9FF781"; if (status !== 0) { status = '' + status + ''; bg = "#F5A9A9"; } tasks.insertAdjacentHTML('beforeend', '' + el + '
') }); jQuery('button:contains("Errors")').removeClass('hidden'); } if (alldata['Warnings'].length > 0) { alldata['Warnings'].forEach(function(el) { warnings.insertAdjacentHTML('beforeend', '' + el + '
') }); jQuery('button:contains("Warnings")').removeClass('hidden'); } if (alldata['Exceptions'].length > 0) { alldata['Exceptions'].forEach(function(el) { exceptions.insertAdjacentHTML('beforeend', '' + el + '
') }); jQuery('button:contains("Exceptions")').removeClass('hidden'); } if (alldata['Job globals'].length > 0) { options.insertAdjacentHTML('beforeend', 'Job globals:
') alldata['Job globals'].forEach(function(el) { options.insertAdjacentHTML('beforeend', '' + el + '
') }); options.insertAdjacentHTML('beforeend', '') } if (alldata['Job options'].length > 0) { options.insertAdjacentHTML('beforeend', '
Job options:
') alldata['Job options'].forEach(function(el) { options.insertAdjacentHTML('beforeend', '' + el + '
') }); options.insertAdjacentHTML('beforeend', '') } if (Object.entries(alldata['Node options']).length > 0) { Object.entries(alldata['Node options']).forEach(function(el) { options.insertAdjacentHTML('beforeend', '
Node options: ' + el[0] + '
'); el[1].forEach(function(els) { options.insertAdjacentHTML('beforeend', '' + els + '
'); }) options.insertAdjacentHTML('beforeend', ''); }) } // extract functions function checkVersion(line) { if (/SNBSVH_200J/.test(line)) { var version = line.match(/([0-9]\.[0-9])(?:;)/)[1]; alldata['Version'] = version; alldata['Master IP'] = getIp(line); details.insertAdjacentHTML('beforeend', '
DPX Version: ' + version + '
') details.insertAdjacentHTML('beforeend', 'DPX Master IP: ' + getIp(line) + '
') } if (/SNBJH_3075J/.test(line)) { var version = line.match(/([0-9]\.[0-9])(?:;)/)[1]; alldata['Version'] = version; alldata['Master IP'] = getIp(line); details.insertAdjacentHTML('beforeend', 'DPX Version: ' + version + '
') details.insertAdjacentHTML('beforeend', 'DPX Master IP: ' + getIp(line) + '
') } } function checkJobType(line) { if (/SNBSVH_220J/.test(line)) { var jobtype = line.match(/(?:type: )(.*)(?:\))/)[1]; var jobname = line.match(/(?:name: )(.*)(?:,)/)[1]; alldata['Job Name'] = jobname; alldata['Job Type'] = jobtype; details.insertAdjacentHTML('beforeend', 'Name of job: ' + jobname + '
') details.insertAdjacentHTML('beforeend', 'Type of job: ' + jobtype + '
') } if (/SNBJH_3403J/.test(line)) { alldata['Job Name'] = "Condense"; alldata['Job Type'] = "Condense"; details.insertAdjacentHTML('beforeend', 'Name of job: Condense
') details.insertAdjacentHTML('beforeend', 'Type of job: Condense
') } if (/SNBJH_3208J/.test(line)) { var jobname = line.match(/New Job ([A-Z,a-z,0-9,\-,_]{1,16})/)[1]; var jobtype = line.match(/job type (.*)\)/)[1]; alldata['Job Name'] = jobname; alldata['Job Type'] = jobtype; details.insertAdjacentHTML('beforeend', 'Name of job: ' + jobname + '
') details.insertAdjacentHTML('beforeend', 'Type of job: ' + jobtype + '
') } } function checkJobOptions(line) { if (/SNBSVH_264J/.test(line)) { var jobOptions = line.match(/Node\((.*)\) options:(.*)/); if (alldata['Node options'][jobOptions[1]] == undefined) { alldata['Node options'][jobOptions[1]] = []; } var optionsArray = jobOptions[2].split(','); optionsArray.forEach(function(el) { alldata['Node options'][jobOptions[1]].push(el.trim()); }); } } function checkJobGlobals(line) { if (/SNBSVH_361J/.test(line)) { var jobOptions = line.match(/Job globals:(.*)/); var optionsArray = jobOptions[1].split(';'); optionsArray.forEach(function(el) { alldata['Job globals'].push(el.trim()); }); } } function checkJobGlobalOptions(line) { if (/SNBSVH_222J/.test(line)) { var jobOptions = line.match(/Job options:(.*)/); var optionsArray = jobOptions[1].split(','); optionsArray.forEach(function(el) { alldata['Job options'].push(el.trim()); }); } if (/SNBJH_3498J/.test(line)) { var jobOptions = line.match(/Job options: (.*)/); var optionsArray = jobOptions[1].split(';'); optionsArray.forEach(function(el) { alldata['Job options'].push(el.trim()); }); } } function checkCompletitionStatus(line) { if (/SNBSVH_225J/.test(line)) { var status = line.match(/Job [0-9]{10}: (.*)/)[1]; var taskStatus = line.match(/(?:Completion status )([0-9]{1,2});/)[1]; var runTime = line.match(/(?:Run time )([0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2});/)[1]; var dataVolume = line.match(/(?:Data volume)(.+(bytes|KB|MB|GB|n\/a));/)[1]; var throughPut = line.match(/(?:Throughput)(.+(bytes|KB\/s|MB\/s|GB\/s|n\/a));/)[1]; var transferRate = line.match(/(?:Data transfer rate)(.+(bytes|KB\/s|MB\/s|GB\/s|n\/a))/)[1]; alldata['Job status']['Status'] = taskStatus; alldata['Job status']['Run time'] = runTime; alldata['Job status']['Data volume'] = dataVolume; alldata['Job status']['Throughput'] = throughPut; alldata['Job status']['Transfer rate'] = transferRate; } } function checkTasks(line) { if (/SNBSVH_232J/.test(line)) { var tasks = line.match(/Task ([0-9]{1,2})/)[1]; var taskStatus = line.match(/(?:Completion status )([0-9]{1,2});/)[1]; var runTime = line.match(/(?:Run time )([0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2});/)[1]; var dataVolume = line.match(/(?:Data volume)(.+(bytes|KB|MB|GB|n\/a));/)[1]; var throughPut = line.match(/(?:Throughput)(.+(bytes|KB\/s|MB\/s|GB\/s|n\/a))/)[1] if (alldata['Tasks'][tasks] == undefined) { alldata['Tasks'][tasks] = {} } alldata['Tasks'][tasks]['Status'] = taskStatus; alldata['Tasks'][tasks]['Run time'] = runTime; alldata['Tasks'][tasks]['Data volume'] = dataVolume.trim(); alldata['Tasks'][tasks]['Throughput'] = throughPut.trim(); } if (/SNBSVH_230J/.test(line)) { var tasks = line.match(/Task ([0-9]{1,2})/)[1]; var taskDisk = line.match(/disk: (.*)\)/)[1]; var taskNode = line.match(/node: (.*)\,/)[1]; if (alldata['Tasks'][tasks] == undefined) { alldata['Tasks'][tasks] = {} } alldata['Tasks'][tasks]['Disk'] = taskDisk; alldata['Tasks'][tasks]['Node'] = taskNode; } } function findWarnings(line) { if (/\s[A-Z]{6}([0-9]|_)[0-9]{3}W/.test(line)) { alldata['Warnings'].push(line); } } function findErrors(line) { if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}E/.test(line)) { alldata['Errors'].push(line); } } function findExceptions(line) { if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}X/.test(line)) { alldata['Exceptions'].push(line); } } function getIp(line) { return line.match(/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/)[0]; } function getClientName(line) { if (/SNBAPH_466J/.test(line)) { var clientIp = getIp(line); var clientName = line.match(/\((.*)\)/)[1]; alldata['Clients'][clientName] = clientIp; } } function writeLog(line, idx) { if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}E/.test(line)) { content.insertAdjacentHTML('beforeend', '' + idx + ' ' + line + '
') } else if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}W/.test(line)) { content.insertAdjacentHTML('beforeend', '' + idx + ' ' + line + '
') } else if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}X/.test(line)) { content.insertAdjacentHTML('beforeend', '' + idx + ' ' + line + '
') }else { content.insertAdjacentHTML('beforeend', '' + idx + ' ' + line + '
') } } function openTab(evt, tabName) { var i, tabcontent, tablinks; tabcontent = document.getElementsByClassName("tabcontent"); for (i = 0; i < tabcontent.length; i++) { tabcontent[i].style.display = "none"; } tablinks = document.getElementsByClassName("tablinks"); for (i = 0; i < tablinks.length; i++) { tablinks[i].className = tablinks[i].className.replace(" active", ""); } document.getElementById(tabName).style.display = "block"; evt.currentTarget.className += " active"; }