first commit
This commit is contained in:
13
views/includes/head.pug
Normal file
13
views/includes/head.pug
Normal file
@ -0,0 +1,13 @@
|
||||
// - includes/head.pug
|
||||
head
|
||||
title= title
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1")
|
||||
script(src='assets/js/jquery.min.js')
|
||||
script(src='assets/js/popper.min.js')
|
||||
link#bootstrap-css(href='assets/css/bootstrap.min.css', rel='stylesheet')
|
||||
script(src='assets/js/bootstrap.min.js')
|
||||
link(
|
||||
rel='stylesheet'
|
||||
href='assets/css/main.css'
|
||||
)
|
||||
link(rel='shortcut icon' type='image/png' href='assets/images/favicon.ico')
|
||||
27
views/includes/navigation.pug
Normal file
27
views/includes/navigation.pug
Normal file
@ -0,0 +1,27 @@
|
||||
// - includes/navigation.pug
|
||||
.announcement.hidden
|
||||
.announce
|
||||
span.icon.icon-eye-slash
|
||||
|
||||
nav.navbar.navbar-expand-lg.navbar-light.bg-light
|
||||
a.navbar-brand(href='/')
|
||||
img.left-control-logo(src='assets/images/logo-catalogic-colored.svg' alt='Catalogic Log Parser')
|
||||
span.left-control-title Log Parser
|
||||
button.navbar-toggler(type='button' data-toggle='collapse' data-target='#navbarNavAltMarkup' aria-controls='navbarNavAltMarkup' aria-expanded='false' aria-label='Toggle navigation')
|
||||
span.navbar-toggler-icon
|
||||
#navbarNavAltMarkup.collapse.navbar-collapse
|
||||
.navbar-nav
|
||||
a.nav-item.nav-link(href='/' class="d-none d-md-block d-sm-none")
|
||||
| Upload
|
||||
span.sr-only (current)
|
||||
a.nav-item.nav-link(href='https://kb.catalogicsoftware.com/search/' target='_blank') KB
|
||||
a.nav-item.nav-link(href='https://jira.catalogicsoftware.com/' target='_blank') Jira
|
||||
a.nav-item.nav-link(href='https://gitlab.ad.catalogic.us/pwagner/joblog-parser/-/issues' target='_blank') Report bug
|
||||
|
||||
|
||||
script.
|
||||
var path = location.search !== "" ? location.pathname + location.search: location.pathname;
|
||||
jQuery('.navbar a[href="' + path + '"]').addClass('active');
|
||||
function closeWin() {
|
||||
window.close();
|
||||
}
|
||||
38
views/intro.pug
Normal file
38
views/intro.pug
Normal file
@ -0,0 +1,38 @@
|
||||
doctype html
|
||||
include includes/head.pug
|
||||
body
|
||||
include includes/navigation.pug
|
||||
|
||||
.container-fluid
|
||||
.row.page-container
|
||||
.col-md-6.col-sm-12.col-xs-12
|
||||
.row
|
||||
.col
|
||||
h3   Welcome to Catalogic Log Parser
|
||||
.row
|
||||
.col
|
||||
.container-fluid
|
||||
p Upload a file to start.
|
||||
form.logFile(action='/upload' method='post' enctype='multipart/form-data')
|
||||
.form-group
|
||||
input.form-control.upload(id="file" type='file', name='logfile' required)
|
||||
if (imageSuccess)
|
||||
span(class="formSuccess") = imageSuccess
|
||||
div.text-right
|
||||
p Questions?
|
||||
a.btn.btnSubmit(href="mailto:pwagner@catalogicsoftware.com") Send Patrick an email
|
||||
|
||||
script.
|
||||
$('input#file').change(function(e) {
|
||||
e.preventDefault();
|
||||
var error = $('form.logFile > .formError');
|
||||
if (error) {
|
||||
$('form.logFile > .formError').remove();
|
||||
}
|
||||
var isLog = /(.log|.txt)$/i.test($('#file').val());
|
||||
if (isLog) {
|
||||
$('form.logFile').submit();
|
||||
} else {
|
||||
$('<span class="formError">Please use a LOG or TXT file</span>').insertAfter($('#file'));
|
||||
}
|
||||
});
|
||||
345
views/upload.pug
Normal file
345
views/upload.pug
Normal file
@ -0,0 +1,345 @@
|
||||
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', '<p class="description"><h3>Clients</h3>')
|
||||
for (let i in alldata['Clients']) {
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description">' + alldata['Clients'][i] + ' - ' + [i] + '</p>')
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.entries(alldata['Job status']).length > 0) {
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><h3>Status</h3>')
|
||||
if (parseInt(alldata['Job status']['Status']) !== 0) {
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Completition status:</b> <span class=" code error">' + alldata['Job status']['Status'] + '</span></p>')
|
||||
} else {
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Completition status:</b> <span class=" code success">' + alldata['Job status']['Status'] + '</span></p>')
|
||||
}
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Run time:</b> ' + alldata['Job status']['Run time'] + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Data volume:</b> ' + alldata['Job status']['Data volume'] + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Throughput:</b> ' + alldata['Job status']['Throughput'] + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Transfer rate:</b> ' + alldata['Job status']['Transfer rate'] + '</p>')
|
||||
}
|
||||
|
||||
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 = '<span class="code error">' + status + '</span>';
|
||||
bg = "#F5A9A9";
|
||||
}
|
||||
tasks.insertAdjacentHTML('beforeend', '<div class="row" style="border: 1px solid black; margin: 8px; background: #fcfcfc"><div class="col-1" style="background: ' + bg + '">Task ' + el[0] + '</div><div class="col">Node: '+ el[1]["Node"] + '<br>Disk: '+ el[1]["Disk"] + '<br>Status: '+ status + '<br>Run time: '+ el[1]["Run time"] + '<br>Data volume: '+ el[1]["Data volume"] + '<br>Throughput: '+ el[1]["Throughput"] + '</div></div>')
|
||||
})
|
||||
jQuery('button:contains("Tasks")').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (alldata['Errors'].length > 0) {
|
||||
alldata['Errors'].forEach(function(el) {
|
||||
errors.insertAdjacentHTML('beforeend', '<p class="code">' + el + '</p>')
|
||||
});
|
||||
jQuery('button:contains("Errors")').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (alldata['Warnings'].length > 0) {
|
||||
alldata['Warnings'].forEach(function(el) {
|
||||
warnings.insertAdjacentHTML('beforeend', '<p class="code">' + el + '</p>')
|
||||
});
|
||||
jQuery('button:contains("Warnings")').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (alldata['Exceptions'].length > 0) {
|
||||
alldata['Exceptions'].forEach(function(el) {
|
||||
exceptions.insertAdjacentHTML('beforeend', '<p class="code">' + el + '</p>')
|
||||
});
|
||||
jQuery('button:contains("Exceptions")').removeClass('hidden');
|
||||
}
|
||||
|
||||
if (alldata['Job globals'].length > 0) {
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description"><b>Job globals:</b></p>')
|
||||
alldata['Job globals'].forEach(function(el) {
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description">' + el + '</p>')
|
||||
});
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description"> </p>')
|
||||
}
|
||||
|
||||
if (alldata['Job options'].length > 0) {
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description"><b>Job options:</b></p>')
|
||||
alldata['Job options'].forEach(function(el) {
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description">' + el + '</p>')
|
||||
});
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description"> </p>')
|
||||
}
|
||||
|
||||
if (Object.entries(alldata['Node options']).length > 0) {
|
||||
Object.entries(alldata['Node options']).forEach(function(el) {
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description"><b>Node options:</b> ' + el[0] + '</p>');
|
||||
el[1].forEach(function(els) {
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description">' + els + '</p>');
|
||||
})
|
||||
options.insertAdjacentHTML('beforeend', '<p class="description"> </p>');
|
||||
})
|
||||
}
|
||||
|
||||
// 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', '<p class="description"><b>DPX Version:</b> ' + version + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>DPX Master IP:</b> ' + getIp(line) + '</p>')
|
||||
}
|
||||
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', '<p class="description"><b>DPX Version:</b> ' + version + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>DPX Master IP:</b> ' + getIp(line) + '</p>')
|
||||
}
|
||||
}
|
||||
|
||||
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', '<p class="description"><b>Name of job:</b> ' + jobname + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Type of job:</b> ' + jobtype + '</p>')
|
||||
}
|
||||
if (/SNBJH_3403J/.test(line)) {
|
||||
alldata['Job Name'] = "Condense";
|
||||
alldata['Job Type'] = "Condense";
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Name of job:</b> Condense</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Type of job:</b> Condense</p>')
|
||||
}
|
||||
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', '<p class="description"><b>Name of job:</b> ' + jobname + '</p>')
|
||||
details.insertAdjacentHTML('beforeend', '<p class="description"><b>Type of job:</b> ' + jobtype + '</p>')
|
||||
}
|
||||
}
|
||||
|
||||
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', '<p class="code error"><span class="idx">' + idx + '</span> ' + line + '</p>')
|
||||
} else if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}W/.test(line)) {
|
||||
content.insertAdjacentHTML('beforeend', '<p class="code warning"><span class="idx">' + idx + '</span> ' + line + '</p>')
|
||||
} else if (/\s[A-Z]{5}([A-Z]|_)([0-9]|_)[0-9]{3}X/.test(line)) {
|
||||
content.insertAdjacentHTML('beforeend', '<p class="code error"><span class="idx">' + idx + '</span> ' + line + '</p>')
|
||||
}else {
|
||||
content.insertAdjacentHTML('beforeend', '<p class="code"><span class="idx">' + idx + '</span> ' + line + '</p>')
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
Reference in New Issue
Block a user