1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Added error log parsing capability

This commit is contained in:
Bryan Roe 2021-04-13 18:14:13 -07:00
parent 444e9e43e0
commit 20086dc361
2 changed files with 196 additions and 1 deletions

View file

@ -2736,7 +2736,7 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
var response = null;
switch (cmd) {
case 'help': { // Displays available commands
var fin = '', f = '', availcommands = 'agentupdate,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg';
var fin = '', f = '', availcommands = 'agentupdate,errorlog,msh,timerinfo,coreinfo,coredump,service,fdsnapshot,fdcount,startupoptions,alert,agentsize,versions,help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,wslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,openurl,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,wallpaper,agentmsg';
if (require('os').dns != null) { availcommands += ',dnsinfo'; }
if (process.platform == 'win32') { availcommands += ',safemode,wpfhwacceleration,uac'; }
if (amt != null) { availcommands += ',amt,amtconfig,amtevents'; }
@ -2764,6 +2764,22 @@ function processConsoleCommand(cmd, args, rights, sessionid) {
agentUpdate_Start(null, { sessionid: sessionid });
}
break;
case 'errorlog':
switch(args['_'].length)
{
case 0:
// All Error Logs
response = JSON.stringify(require('util-agentlog').read(), null, 1);
break;
case 1:
// Error Logs, by either count or timestamp
response = JSON.stringify(require('util-agentlog').read(parseInt(args['_'][0])), null, 1);
break;
default:
response = "Proper usage:\r\n errorlog [lastCount|linuxEpoch]";
break;
}
break;
case 'msh':
response = JSON.stringify(_MSH(), null, 2);
break;