Fix in RulesEngine, add current rule files and add License

This commit is contained in:
Joe
2019-01-09 06:27:00 -06:00
parent 9d5a94d98c
commit 1975167745
6 changed files with 3174 additions and 91 deletions

View File

@@ -45,7 +45,6 @@ exports.RuleEngine = class RuleEngine {
processData(inputLine) {
let inputData = inputLine.data;
logger.log("debug", "ProcessingType " + inputLine.processingType);
logger.log("debug", "InputLine " + JSON.stringify(inputLine));
let allWhiteFilterRules = this.ruleSet[inputLine.processingType].rules;
if (this.processLogicOr(allWhiteFilterRules, inputData)) { return (true); }
logger.log("debug", "No whitelisting matched; returning false");
@@ -104,32 +103,32 @@ exports.RuleEngine = class RuleEngine {
}
processLogicFlat(theWhiteFilterRule, inputData) {
logger.log("debug", "Logic FLAT start - whiteFilterRule: " + JSON.stringify(theWhiteFilterRule));
logger.log("debug", "inputData: " + JSON.stringify(inputData));
let isKnownComp = false;
let retVal = false;
if (theWhiteFilterRule.Comp === "===") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] === theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "!==") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] !== theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "<") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] < theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === ">") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] > theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "<=") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] <= theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === ">=") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] >= theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "~") {
isKnownComp = true;
logger.log("debug", "RegexFilter: " + theWhiteFilterRule.Value + " || " + inputData[theWhiteFilterRule.Field].replace(/\r/g, "\\r").replace(/\n/g, "\\n"));
retVal = this.reTest(theWhiteFilterRule.Value, inputData[theWhiteFilterRule.Field]);
}
try {
if (theWhiteFilterRule.Comp === "===") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] === theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "<") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] < theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === ">") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] > theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "<=") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] <= theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === ">=") {
isKnownComp = true;
if (inputData[theWhiteFilterRule.Field] >= theWhiteFilterRule.Value) {retVal = true;}
} else if (theWhiteFilterRule.Comp === "~") {
isKnownComp = true;
logger.log("debug", "RegexFilter: " + theWhiteFilterRule.Value + " || " + ""+inputData[theWhiteFilterRule.Field].replace(/\r/g, "\\r").replace(/\n/g, "\\n"));
retVal = this.reTest(theWhiteFilterRule.Value, inputData[theWhiteFilterRule.Field]);
}
} catch (ex) {
logger.log("error", "LogicFlat-Error " + ex + " WhiteFilterRule: " + JSON.stringify(theWhiteFilterRule) + " InputData " + JSON.stringify(inputData));
}
if (!isKnownComp) {
logger.log("error", "The configured Comp '" + theWhiteFilterRule.Comp + "' is unknown.")

View File

@@ -19,7 +19,23 @@ const logger = winston.createLogger({
]
});
logger.log("info", "Starting casRpsLogExtractor v0.1 by j.tretter@gmail.com");
console.log(`casRpsLogExtractor Copyright (C) 2019 j.tretter@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.`);
logger.log("info", `casRpsLogExtractor v0.1 Starting`);
const config = JSON.parse(fs.readFileSync("casRpsLogExtractor.config.json", "utf8"));
logger.log("debug", "Config" + JSON.stringify(config))

View File

@@ -20,6 +20,21 @@ const logger = winston.createLogger({
const processingType = "diskusage";
console.log(`diskUsageMonitor Copyright (C) 2019 j.tretter@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.`);
logger.log("info", "Starting diskUsageMonitor v0.1 by j.tretter@gmail.com");
const config = JSON.parse(fs.readFileSync("diskUsageMonitor.config.json", "utf8"));
logger.log("debug", "Config" + JSON.stringify(config));

BIN
log/.issues.log.un~ Normal file

Binary file not shown.

View File

@@ -22,7 +22,22 @@ const logger = winston.createLogger({
const ruleEngine = new RuleEngine("*");
logger.log("info", "Service Starting logAggregator v0.1 by j.tretter@gmail.com");
console.log(`logAggregator Service Copyright (C) 2019 j.tretter@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.`);
logger.log("info","logAggregator Service v0.1 Starting")
const server = micro(async (req, res) => {
const js = await json(req);

File diff suppressed because it is too large Load Diff