prep for syslog

This commit is contained in:
Paul
2019-11-19 23:11:26 +01:00
parent 9a0780ba77
commit a04b2ff708
10 changed files with 75 additions and 546 deletions

View File

@@ -47,18 +47,6 @@ var networks = {
]
}
var eventlog = {
"command": "eventlist",
"page": 1,
"haspages": 1,
"list": [
"{\"type\":\"WARN\",\"src\":\"system\",\"desc\":\"test data\",\"data\":\"Record #1\",\"time\": 1563371160}",
"{\"type\":\"WARN\",\"src\":\"system\",\"desc\":\"test data\",\"data\":\"Record #2\",\"time\":0}",
"{\"type\":\"INFO\",\"src\":\"system\",\"desc\":\"System booted Local Time is 13:02:54 CET\",\"data\":\"\",\"time\":1572613374}",
"{\"type\":\"WARN\",\"src\":\"system\",\"desc\":\"test data\",\"data\":\"Record #3\",\"time\":0}"
]
}
var configfile = {
"command": "configfile",
"network": {
@@ -113,16 +101,6 @@ var custom_configfile = {
}
};
function sendEventLog() {
wss.broadcast(eventlog);
var res = {
"command": "result",
"resultof": "eventlist",
"result": true
};
wss.broadcast(res);
}
function sendStatus() {
var stats = {
"command": "status",
@@ -252,24 +230,10 @@ wss.on('connection', function connection(ws) {
res.epoch = 1572613374; // this is 13:02:54 CET
wss.broadcast(res);
break;
case "settime":
console.log("[INFO] Setting time (fake)");
var res = {};
res.command = "gettime";
res.epoch = Math.floor((new Date).getTime() / 1000);
wss.broadcast(res);
break;
case "getconf":
console.log("[INFO] Sending system configuration file (if set any)");
wss.broadcast(configfile);
break;
case "geteventlog":
console.log("[INFO] Sending eventlog");
sendEventLog();
break;
case "clearevent":
console.log("[INFO] Clearing eventlog");
break;
case "restart":
console.log("[INFO] Restart");
break;