Merge pull request 'dev-add-daysTopull' (#19) from dev-add-daysTopull into main
Reviewed-on: #19
This commit is contained in:
commit
82c8a5bb4a
@ -49,12 +49,14 @@ You will need a *config.toml* file in the same directory where *inex.py* or inex
|
|||||||
| logging | Set if, where and level of logging |
|
| logging | Set if, where and level of logging |
|
||||||
|
|
||||||
The following settings are not obvious as to how they affect the application.
|
The following settings are not obvious as to how they affect the application.
|
||||||
|
> Note the #comments
|
||||||
```
|
```
|
||||||
[fortraPlatform]
|
[fortraPlatform]
|
||||||
selectedPlatform = "dev" # This will modify which environment the data is pushed to. The tenant_id and secret must be manually modified.
|
selectedPlatform = "dev" # This will modify which environment the data is pushed to. The tenant_id and secret must be manually modified.
|
||||||
|
|
||||||
[database]
|
[database]
|
||||||
overrideEmbeddedquery = true # Choose if embedded query should be overridden.
|
overrideEmbeddedquery = true # Choose if embedded query should be overridden.
|
||||||
|
daysTopull = 30 # This setting is only related to the embedded query. Please note this will not affect query provided in config.toml
|
||||||
driver = "ODBC Driver 18 for SQL Server" # Select which windows driver should be used. This one is recommended.
|
driver = "ODBC Driver 18 for SQL Server" # Select which windows driver should be used. This one is recommended.
|
||||||
|
|
||||||
[output]
|
[output]
|
||||||
|
@ -1,6 +1,33 @@
|
|||||||
[fortraPlatform]
|
[fortraPlatform]
|
||||||
selectedPlatform = "dev"
|
selectedPlatform = "dev"
|
||||||
|
|
||||||
|
[output]
|
||||||
|
pushToplatform = true
|
||||||
|
dumpTojson = true
|
||||||
|
filename ="./data.json"
|
||||||
|
token = "./.token"
|
||||||
|
|
||||||
|
[logging]
|
||||||
|
use_log = true
|
||||||
|
logLevel = "debug"
|
||||||
|
logPath = "./inex.log"
|
||||||
|
|
||||||
|
[database]
|
||||||
|
overrideEmbeddedquery = false
|
||||||
|
daysTopull = 10
|
||||||
|
driver = "ODBC Driver 18 for SQL Server"
|
||||||
|
server = "192.168.x.x"
|
||||||
|
database = "EFTDB"
|
||||||
|
user = "a"
|
||||||
|
password = "a"
|
||||||
|
query = """DECLARE @stopTime DATETIME2
|
||||||
|
SET @stopTime=DATEADD(DAY, -30, GETDATE())
|
||||||
|
SELECT p.ProtocolCommandID, t.Time_stamp, p.RemoteIP, p.RemotePort, p.LocalIP, p.LocalPort, p.Protocol, p.SiteName, p.Command, p.FileName, p.VirtualFolderName, p.FileSize, p.TransferTime, p.BytesTransferred, p.Description, p.ResultID, t.TransactionID, p.Actor, t.TransactionObject, t.NodeName, t.TransactionGUID, a.Protocol user_type
|
||||||
|
FROM tbl_Transactions t
|
||||||
|
Full JOIN tbl_ProtocolCommands p ON(t.TransactionID=p.TransactionID)
|
||||||
|
Full JOIN tbl_Authentications a ON(t.TransactionID=a.TransactionID)
|
||||||
|
WHERE p.Time_stamp>@stopTime AND p.Command IS NOT NULL"""
|
||||||
|
|
||||||
[fortraPlatform.dev]
|
[fortraPlatform.dev]
|
||||||
idp = "https://foundation.foundation-dev.cloudops.fortradev.com/idp/realms/products/protocol/openid-connect/token"
|
idp = "https://foundation.foundation-dev.cloudops.fortradev.com/idp/realms/products/protocol/openid-connect/token"
|
||||||
efc_url = "https://efc.efc-dev.cloudops.fortradev.com"
|
efc_url = "https://efc.efc-dev.cloudops.fortradev.com"
|
||||||
@ -22,34 +49,8 @@ tenant_id = ""
|
|||||||
client_id = "eft-event-generator-confidential"
|
client_id = "eft-event-generator-confidential"
|
||||||
secret = ""
|
secret = ""
|
||||||
|
|
||||||
[database]
|
|
||||||
overrideEmbeddedquery = false
|
|
||||||
driver = "ODBC Driver 18 for SQL Server"
|
|
||||||
server = "192.168.x.x"
|
|
||||||
database = "EFTDB"
|
|
||||||
user = "a"
|
|
||||||
password = "a"
|
|
||||||
query = """DECLARE @stopTime DATETIME2
|
|
||||||
SET @stopTime=DATEADD(DAY, -30, GETDATE())
|
|
||||||
SELECT p.ProtocolCommandID, t.Time_stamp, p.RemoteIP, p.RemotePort, p.LocalIP, p.LocalPort, p.Protocol, p.SiteName, p.Command, p.FileName, p.VirtualFolderName, p.FileSize, p.TransferTime, p.BytesTransferred, p.Description, p.ResultID, t.TransactionID, p.Actor, t.TransactionObject, t.NodeName, t.TransactionGUID, a.Protocol user_type
|
|
||||||
FROM tbl_Transactions t
|
|
||||||
Full JOIN tbl_ProtocolCommands p ON(t.TransactionID=p.TransactionID)
|
|
||||||
Full JOIN tbl_Authentications a ON(t.TransactionID=a.TransactionID)
|
|
||||||
WHERE p.Time_stamp>@stopTime AND p.Command IS NOT NULL"""
|
|
||||||
|
|
||||||
[immutables]
|
[immutables]
|
||||||
prd_instance_id = 1
|
prd_instance_id = 1
|
||||||
product_guid = "asdf"
|
product_guid = "asdf"
|
||||||
product_name = "EFT"
|
product_name = "EFT"
|
||||||
product_version ="8.1.0.9"
|
product_version ="8.1.0.9"
|
||||||
|
|
||||||
[output]
|
|
||||||
pushToplatform = true
|
|
||||||
dumpTojson = true
|
|
||||||
filename ="./data.json"
|
|
||||||
token = "./.token"
|
|
||||||
|
|
||||||
[logging]
|
|
||||||
use_log = true
|
|
||||||
logLevel = "debug"
|
|
||||||
logPath = "./inex.log"
|
|
3
inex.py
3
inex.py
@ -52,6 +52,7 @@ class Inex:
|
|||||||
self.writeJsonfile = self.config["output"]["dumpTojson"]
|
self.writeJsonfile = self.config["output"]["dumpTojson"]
|
||||||
self.pushToplatform = self.config["output"]["pushToplatform"]
|
self.pushToplatform = self.config["output"]["pushToplatform"]
|
||||||
self.queryOverride = self.config["database"]["overrideEmbeddedquery"]
|
self.queryOverride = self.config["database"]["overrideEmbeddedquery"]
|
||||||
|
self.queryDaystopull = self.config["database"]["daysTopull"]
|
||||||
except:
|
except:
|
||||||
print("No config.toml. Please use example file and configure appropriately")
|
print("No config.toml. Please use example file and configure appropriately")
|
||||||
exit(1)
|
exit(1)
|
||||||
@ -70,7 +71,7 @@ class Inex:
|
|||||||
self.cursor = self.ic.inexSql.connectDatabase(self, self.db, self.dbDriver, self.dbServer, self.dbDatabase, self.dbUser, self.dbPassword)
|
self.cursor = self.ic.inexSql.connectDatabase(self, self.db, self.dbDriver, self.dbServer, self.dbDatabase, self.dbUser, self.dbPassword)
|
||||||
|
|
||||||
|
|
||||||
self.data = self.ic.inexSql.databaseQuery(self, self.cursor, self.sq.sqlQuerymodel.queryData(self.queryOverride,self.dbQuery))
|
self.data = self.ic.inexSql.databaseQuery(self, self.cursor, self.sq.sqlQuerymodel.queryData(self.queryOverride,self.dbQuery, self.queryDaystopull))
|
||||||
|
|
||||||
self.modifiedData = processData(self.data, dataTemplate, prd_instance_id=self.prdInstanceID,\
|
self.modifiedData = processData(self.data, dataTemplate, prd_instance_id=self.prdInstanceID,\
|
||||||
product_guid=self.productGUID,product_name=self.productName,product_version=self.productVersion)
|
product_guid=self.productGUID,product_name=self.productName,product_version=self.productVersion)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
class sqlQuerymodel:
|
class sqlQuerymodel:
|
||||||
def queryData(overRideflag, configQuery):
|
def queryData(overRideflag, configQuery, daysTopull):
|
||||||
"""Embedded query data"""
|
"""Embedded query data"""
|
||||||
q ="""DECLARE @stopTime DATETIME2
|
q ="""DECLARE @stopTime DATETIME2
|
||||||
SET @stopTime=DATEADD(DAY, -30, GETDATE())
|
SET @stopTime=DATEADD(DAY, -30, GETDATE())
|
||||||
@ -7,5 +7,5 @@ class sqlQuerymodel:
|
|||||||
FROM tbl_Transactions t
|
FROM tbl_Transactions t
|
||||||
Full JOIN tbl_ProtocolCommands p ON(t.TransactionID=p.TransactionID)
|
Full JOIN tbl_ProtocolCommands p ON(t.TransactionID=p.TransactionID)
|
||||||
Full join tbl_Authentications a ON(t.TransactionID=a.TransactionID)
|
Full join tbl_Authentications a ON(t.TransactionID=a.TransactionID)
|
||||||
WHERE p.Time_stamp>@stopTime AND p.Command IS NOT NULL"""
|
WHERE p.Time_stamp>@stopTime AND p.Command IS NOT NULL""".replace("30", str(daysTopull))
|
||||||
return configQuery if overRideflag else q
|
return configQuery if overRideflag else q
|
Loading…
x
Reference in New Issue
Block a user