Class JsonLoggerSqlFirewallTrigger
java.lang.Object
org.kawanfw.sql.api.server.firewall.trigger.JsonLoggerSqlFirewallTrigger
- All Implemented Interfaces:
SqlFirewallTrigger
public class JsonLoggerSqlFirewallTrigger extends Object implements SqlFirewallTrigger
A trigger that will log using JSON format the
SqlEvent
info
and the sqlFirewallManager
class name.- Since:
- 11.0
- Author:
- Nicolas de Pomereu
-
Constructor Summary
Constructors Constructor Description JsonLoggerSqlFirewallTrigger()
-
Method Summary
Modifier and Type Method Description static Map<String,String>
getLoggerElements()
Returns the Logger elements (for debug purpose)void
runIfStatementRefused(SqlEvent sqlEvent, SqlFirewallManager sqlFirewallManager, Connection connection)
Logs using JSON format theSqlEvent
and theSqlFirewallManager
class name into aLogger
with parameters: Name:sonLoggerSqlFirewallTrigger
File name pattern:user.home/.kawansoft/log/JsonLoggerSqlFirewallTrigger_%d.log.%i
(example of file created:JsonLoggerSqlFirewallTrigger_2022-07-01.log.1
.). Pattern of each line of log:"%msg%n"
Maximum File Size: 300Mb Total Size Cap: 30Gb These default values may be superseded by creating aJsonLoggerSqlFirewallTrigger.properties
file inuser.home/.kawansoft/conf
.
-
Constructor Details
-
JsonLoggerSqlFirewallTrigger
public JsonLoggerSqlFirewallTrigger()
-
-
Method Details
-
runIfStatementRefused
public void runIfStatementRefused(SqlEvent sqlEvent, SqlFirewallManager sqlFirewallManager, Connection connection) throws IOException, SQLExceptionLogs using JSON format theSqlEvent
and theSqlFirewallManager
class name into aLogger
with parameters:- Name:
sonLoggerSqlFirewallTrigger
- File name pattern:
user.home/.kawansoft/log/JsonLoggerSqlFirewallTrigger_%d.log.%i
(example of file created:JsonLoggerSqlFirewallTrigger_2022-07-01.log.1
.). - Pattern of each line of log:
"%msg%n"
- Maximum File Size: 300Mb
- Total Size Cap: 30Gb
JsonLoggerSqlFirewallTrigger.properties
file inuser.home/.kawansoft/conf
.
See the JsonLoggerSqlFirewallTrigger.properties format.
- Specified by:
runIfStatementRefused
in interfaceSqlFirewallTrigger
- Parameters:
sqlEvent
- the SQL event asked by the client side. Contains all info about the SQL call (client username, database name, IP Address of the client, and SQL statement details).sqlFirewallManager
- the instance that triggers this call.connection
- The current SQL/JDBCConnection
- Throws:
IOException
- if an IOException occursSQLException
- if a SQLException occurs
- Name:
-
getLoggerElements
Returns the Logger elements (for debug purpose)- Returns:
- the lOGGER_ELEMENTS
-