lucee.Componentmodels.util.DBLogger
Copyright since 2016 by Ortus Solutions, Corp www.ortussolutions.com --- This is the logger for firewall actions for cbsecurity. It relies on the `firewall.logs` properties Properties - table : the table to use - schema : the schema to use (if db support it) - dsn : the dsn to use, no dsn, we use the global one - autoCreate : if true, then we will create the table. Defaults to true The columns created in the table are - id : db identifier - logDate : (created date) - action : The action the firewall took: redirect, override, block - blockType : The type of event: authentication, authorization - ip : ip address - userAgent : user agent used - userId : If a logged in user was used, their id - rule : The rule in json that triggered the event - httpMethod : The incoming HTTP Method - host : The host used in the event - path : The routed path in the event - queryString : The query string used - referer : The http referer (if any)
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
settings
|
true
|
false
|
Constructor Summary | |
---|---|
init()
Constructor. |
Method Summary | |
---|---|
boolean
|
canLog()
Is logging enabled or not. |
any
|
clearAll()
Clear all the logs by truncating the table. |
any
|
configure()
Configure the db logger for operation. |
numeric
|
count()
How many logs do we have. |
private any
|
ensureTable()
Verify or create the logging table. |
struct
|
getActionsReport()
Get the actions report. |
struct
|
getBlockTypesReport()
Get the block types report. |
private any
|
getDatabaseVendor()
Get the specifc db we are on. |
private any
|
getDateTimeColumnType()
Get db specific text column type. |
private string
|
getDefaultDatasource()
Get the default application datasource. |
query
|
getLatest([numeric top='100'], [any action=''], [any blockType=''], [any userId=''])
Get the top x logs from the table. |
private any
|
getLimitEnd()
Limit Strategy. |
private any
|
getLimitStart()
Limit Strategy. |
string
|
getSettings()
|
private any
|
getTable()
Return the table name with the appropriate schema included if found. |
private any
|
getTextColumnType()
Get db specific text column type. |
array
|
getTopOffending(any column, [any top='5'])
Get top offending report by passed column. |
any
|
log(any action, [any blockType='AUTHENTICATION'], [any ip='[runtime expression]'], [any host='[runtime expression]'], [any httpMethod='[runtime expression]'], [any path='[runtime expression]'], [any queryString='[runtime expression]'], [any referer='[runtime expression]'], [any userAgent='[runtime expression]'], [any userId=''], [any rule='[runtime expression]'])
Log a firewall event. |
any
|
setSettings(any settings)
|
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
Property Detail |
---|
access
- publicrequired
- falsereturntype
- anyinject
- coldbox:moduleSettings:cbSecurityserializable
- trueMethod Detail |
---|
Is logging enabled or not
Clear all the logs by truncating the table
Configure the db logger for operation
How many logs do we have
Verify or create the logging table
Get the actions report
Get the block types report
Get the specifc db we are on
Get db specific text column type
Get the default application datasource
Get the top x logs from the table
top
- How many logs to get, defaults to 100action
- If passed, we will filter by this actionblockType
- If passed, we will filter by this block typeuserId
- If passed, we will filter by this user idLimit Strategy
Limit Strategy
Return the table name with the appropriate schema included if found.
Get db specific text column type
Get top offending report by passed column
column
- The indexed column to report ontop
- The max report rows, defaults to 5Log a firewall event
action
- The action the firewall took: redirect, override, blockblockType
- The type of event: AUTHENTICATION, AUTHORIZATION, INVALID-HOST, INVALID-IP, NON-SSLip
- ip addresshost
- The host used in the eventhttpMethod
- The incoming HTTP methodpath
- The incoming path infoqueryString
- The query stringreferer
- The incoming referer if anyuserAgent
- user agent useduserId
- If a logged in user was used, their idrule
- The rule in json that triggered the eventsettings