more flexibility for queries (strore in config file)
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
"dbDriver":"mssql", "dbDriverComment":"either mssql (user/password) or mssql/msnodesqlv8 (trustedConnection)",
|
"dbDriver":"mssql", "dbDriverComment":"either mssql (user/password) or mssql/msnodesqlv8 (trustedConnection)",
|
||||||
"processingType": "casrpslog",
|
"processingType": "casrpslog",
|
||||||
"sourceTag": "CCERpsLog",
|
"sourceTag": "CCERpsLog",
|
||||||
|
"maxResultsPerMessage":100,
|
||||||
|
"statements":{
|
||||||
|
"poller":"'select top ' + config.maxResultsPerMessage + ' * from rpslog where pkey > \\'' + maxPKey + '\\' order by pkey'"
|
||||||
|
},
|
||||||
"serverURI": "http://localhost:2222",
|
"serverURI": "http://localhost:2222",
|
||||||
"pollIntervalIdle": 10000,
|
"pollIntervalIdle": 10000,
|
||||||
"sqlConfig": {
|
"sqlConfig": {
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
"processingType": "casrpslog",
|
"processingType": "casrpslog",
|
||||||
"sourceTag": "CCERpsLog",
|
"sourceTag": "CCERpsLog",
|
||||||
"serverURI": "http://localhost:2222",
|
"serverURI": "http://localhost:2222",
|
||||||
|
"maxResultsPerMessage":100,
|
||||||
|
"statements":{
|
||||||
|
"poller":"'select top ' + config.maxResultsPerMessage + ' * from rpslog where pkey > \\'' + maxPKey + '\\' order by pkey'"
|
||||||
|
},
|
||||||
"pollIntervalIdle": 10000,
|
"pollIntervalIdle": 10000,
|
||||||
"UP_sqlConfig": {
|
"UP_sqlConfig": {
|
||||||
"user": "casdbuser",
|
"user": "casdbuser",
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ logger.log("info", `DBExtractor v0.1 Starting`);
|
|||||||
|
|
||||||
|
|
||||||
logger.log("debug", "Config" + JSON.stringify(config))
|
logger.log("debug", "Config" + JSON.stringify(config))
|
||||||
const maxResultsPerMessage=100;
|
|
||||||
let maxPKey = "";
|
let maxPKey = "";
|
||||||
let maxPKeyUnsent = "";
|
let maxPKeyUnsent = "";
|
||||||
let allRows = [];
|
let allRows = [];
|
||||||
@@ -52,7 +51,7 @@ try {
|
|||||||
logger.log("debug", "MaxPKey Loaded: " + maxPKey);
|
logger.log("debug", "MaxPKey Loaded: " + maxPKey);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (ex.errno === -4058) {
|
if (ex.errno === -4058) {
|
||||||
logger.log("info", "MaxPKey-File not existing. Will be created.");
|
logger.log("info", "MaxPKey-File not existing. All data will be processed");
|
||||||
} else {
|
} else {
|
||||||
logger.log("error", "opening DBExtractor.maxPKey.dat :" + ex);
|
logger.log("error", "opening DBExtractor.maxPKey.dat :" + ex);
|
||||||
}
|
}
|
||||||
@@ -67,7 +66,7 @@ try {
|
|||||||
sqlRequest.stream = true;
|
sqlRequest.stream = true;
|
||||||
|
|
||||||
function runNextPoll(){
|
function runNextPoll(){
|
||||||
sqlRequest.query("select top " + maxResultsPerMessage + " * from rpslog where pkey > '" + maxPKey + "' order by pkey");
|
sqlRequest.query(eval(config.statements.poller));
|
||||||
}
|
}
|
||||||
|
|
||||||
runNextPoll();
|
runNextPoll();
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
0010000000a87kj9
|
0010000000a7l7bx
|
||||||
@@ -37,7 +37,8 @@ console.log(`logAggregator Service Copyright (C) 2019 j.tretter@gmail.com
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.`);
|
along with this program. If not, see <https://www.gnu.org/licenses/>.`);
|
||||||
|
|
||||||
logger.log("info","logAggregator Service v0.1 Starting")
|
logger.log("info","logAggregator Service v0.1 Starting");
|
||||||
|
|
||||||
const server = micro(async (req, res) => {
|
const server = micro(async (req, res) => {
|
||||||
const js = await json(req);
|
const js = await json(req);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user