Use module parameters in qlafilter
Moved the qlafilter parameters to module options. This removes the need to parse the options in the filter. Split the options into separate parameters. This allows common options to be combined as enumerations under common parameters.
This commit is contained in:
@ -30,12 +30,6 @@ The QLA filter accepts the following options.
|
||||
ignorecase | Use case-insensitive matching
|
||||
case | Use case-sensitive matching
|
||||
extended | Use extended regular expression syntax (ERE)
|
||||
session_file | Write to session-specific files (default)
|
||||
unified_file | Use one file for all sessions
|
||||
flush_writes | Flush after every write
|
||||
append | Append log entries instead of overwriting files
|
||||
print_service | Add service name to log entries
|
||||
print_session | Add session id to log entries (ignored for session-files)
|
||||
|
||||
To use multiple filter options, list them in a comma-separated list. If no file settings are given, default will be used. Multiple file settings can be enabled simultaneously.
|
||||
|
||||
@ -51,7 +45,7 @@ anymore and the `filebase` parameter should be used instead.
|
||||
|
||||
The QLA filter has one mandatory parameter, `filebase`, and a number of optional parameters. These were introduced in the 1.0 release of MariaDB MaxScale.
|
||||
|
||||
### Filebase
|
||||
### `filebase`
|
||||
|
||||
The basename of the output file created for each session. A session index is added to the filename for each file written. This is a mandatory parameter.
|
||||
|
||||
@ -61,7 +55,7 @@ filebase=/tmp/SqlQueryLog
|
||||
|
||||
The filebase may also be set as the filter, the mechanism to set the filebase via the filter option is superseded by the parameter. If both are set the parameter setting will be used and the filter option ignored.
|
||||
|
||||
### Match
|
||||
### `match`
|
||||
|
||||
An optional parameter that can be used to limit the queries that will be logged by the QLA filter. The parameter value is a regular expression that is used to match against the SQL text. Only SQL statements that matches the text passed as the value of this parameter will be logged.
|
||||
|
||||
@ -71,7 +65,7 @@ match=select.*from.*customer.*where
|
||||
|
||||
All regular expressions are evaluated with the option to ignore the case of the text, therefore a match option of select will match both select, SELECT and any form of the word with upper or lowercase characters.
|
||||
|
||||
### Exclude
|
||||
### `exclude`
|
||||
|
||||
An optional parameter that can be used to limit the queries that will be logged by the QLA filter. The parameter value is a regular expression that is used to match against the SQL text. SQL statements that match the text passed as the value of this parameter will be excluded from the log output.
|
||||
|
||||
@ -81,7 +75,7 @@ exclude=where
|
||||
|
||||
All regular expressions are evaluated with the option to ignore the case of the text, therefore an exclude option of select will exclude statements that contain both select, SELECT or any form of the word with upper or lowercase characters.
|
||||
|
||||
### Source
|
||||
### `source`
|
||||
|
||||
The optional source parameter defines an address that is used to match against the address from which the client connection to MariaDB MaxScale originates. Only sessions that originate from this address will be logged.
|
||||
|
||||
@ -89,7 +83,7 @@ The optional source parameter defines an address that is used to match against t
|
||||
source=127.0.0.1
|
||||
```
|
||||
|
||||
### User
|
||||
### `user`
|
||||
|
||||
The optional user parameter defines a user name that is used to match against the user from which the client connection to MariaDB MaxScale originates. Only sessions that are connected using this username are logged.
|
||||
|
||||
@ -97,6 +91,60 @@ The optional user parameter defines a user name that is used to match against th
|
||||
user=john
|
||||
```
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
**The following parameters were added in MaxScale 2.1.0**
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
### `log_type`
|
||||
|
||||
The type of log file to use. Parameter value is a comma separated list of the
|
||||
following values. The default value is _session_.
|
||||
|
||||
|Value | Description |
|
||||
|--------|--------------------------------|
|
||||
|session |Write to session-specific files |
|
||||
|unified |Use one file for all sessions |
|
||||
|
||||
```
|
||||
log_type=session, unified
|
||||
```
|
||||
|
||||
### `log_data`
|
||||
|
||||
Type of data to log in the log files. Parameter value is a comma separated list
|
||||
of the following values. By default the _date_, _user_ and _query_ options are
|
||||
enabled.
|
||||
|
||||
|Value | Description |
|
||||
|--------|---------------------------------------------------|
|
||||
|service | Log service name |
|
||||
|session | Log unique session id (ignored for session-files) |
|
||||
|date | Log timestamp |
|
||||
|user | Log user and hostname of client |
|
||||
|query | Log the actual query |
|
||||
|
||||
```
|
||||
log_type=date, user, query
|
||||
```
|
||||
|
||||
### `flush`
|
||||
|
||||
Flush log files after every write. The default is false.
|
||||
|
||||
```
|
||||
flush=true
|
||||
```
|
||||
|
||||
### `append`
|
||||
|
||||
Append new entries to log files instead of overwriting them. The default is false.
|
||||
|
||||
```
|
||||
append=true
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1 - Query without primary key
|
||||
|
Reference in New Issue
Block a user