34 KiB
LogDoctor 2.00
Parse Apache2/Nginx/IIS logs and create statistics
|
#include <formats.h>
Classes | |
struct | LogsFormat |
Structure which holds informations about a log format. More... | |
Public Member Functions | |
const LogsFormat | processApacheFormatString (const std::string &format_string) const |
Processes the given string to extrapolate the format for Apache2. More... | |
const LogsFormat | processNginxFormatString (const std::string &format_string) const |
Processes the given string to extrapolate the format for Nginx. More... | |
const LogsFormat | processIisFormatString (const std::string &format_string, const int &log_module) const |
Processes the given string to extrapolate the format for the IIS. More... | |
const QString | getApacheLogSample (const LogsFormat &log_format) const |
Returns a log line sample based on the given format. More... | |
const QString | getNginxLogSample (const LogsFormat &log_format) const |
Returns a log line sample based on the given format. More... | |
const QString | getIisLogSample (const LogsFormat &log_format) const |
Returns a log line sample based on the given format. More... | |
Private Member Functions | |
const std::string | parseApacheEscapes (const std::string &string, const bool strftime=false) const |
Parses the escapes (backslashes) and returns the resulting string. More... | |
const std::string | parseNginxEscapes (const std::string &string) const |
Parses the escapes (backslashes) and returns the resulting string. More... | |
const unsigned | countNewLines (const std::string &initial, const std::string &final, const std::vector< std::string > &separators) const |
Conuts how many new lines are there in the format. More... | |
const size_t | findNginxFieldEnd (const std::string &string, const int start) const |
Finds the end of a Nginx log field. More... | |
void | checkIisString (const std::string &string) const |
Checks whether the format string contains invalid characters or not. More... | |
Private Attributes | |
const std::unordered_map< std::string, std::string > | APACHE_ALF |
< Access logs fields formats More... | |
const std::unordered_map< std::string, std::string > | NGINX_ALF |
< Access logs fields formats | |
const std::unordered_map< std::string, std::string > | IIS_ALF |
< Access logs fields formats (W3C) | |
Detailed Description
Operations for the logs formats
Member Function Documentation
◆ checkIisString()
|
private |
Checks whether the format string contains invalid characters or not.
- Parameters
-
string The format string
- Exceptions
-
LogFormatException
- See also
- processIisFormatString
◆ countNewLines()
|
private |
Conuts how many new lines are there in the format.
Used to join log lines which refer to the same log line
- Parameters
-
initial The initial separator final The final separator separators The separators in the middle
- Returns
- The number of new lines in a single log line
◆ findNginxFieldEnd()
|
private |
Finds the end of a Nginx log field.
- Parameters
-
string The format string start The starting point of the field in the string
- Returns
- The ending poin of the field in the string
- See also
- processNginxFormatString()
◆ getApacheLogSample()
const QString FormatOps::getApacheLogSample | ( | const LogsFormat & | log_format | ) | const |
Returns a log line sample based on the given format.
- Parameters
-
log_format The logs format to use to build the sample
- Returns
- The sample line
- See also
- LogsFormat, Craplog::getLogsFormatSample()
◆ getIisLogSample()
const QString FormatOps::getIisLogSample | ( | const LogsFormat & | log_format | ) | const |
Returns a log line sample based on the given format.
- Parameters
-
log_format The logs format to use to build the sample
- Returns
- The sample line
- See also
- LogsFormat, Craplog::getLogsFormatSample()
◆ getNginxLogSample()
const QString FormatOps::getNginxLogSample | ( | const LogsFormat & | log_format | ) | const |
Returns a log line sample based on the given format.
- Parameters
-
log_format The logs format to use to build the sample
- Returns
- The sample line
- See also
- LogsFormat, Craplog::getLogsFormatSample()
◆ parseApacheEscapes()
|
private |
Parses the escapes (backslashes) and returns the resulting string.
Used to obtain the same result as on Apache2
- Parameters
-
string The string to parse strftime Whether to apply the strftime special rule when parsing or not
- Returns
- The resulting string
- Exceptions
-
LogFormatException
- See also
- processApacheFormatString()
◆ parseNginxEscapes()
|
private |
Parses the escapes (backslashes) and returns the resulting string.
Used to obtain the same result as on Nginx
- Parameters
-
string The string to parse
- Returns
- The resulting string
- Exceptions
-
LogFormatException
- See also
- processNginxFormatString()
◆ processApacheFormatString()
const FormatOps::LogsFormat FormatOps::processApacheFormatString | ( | const std::string & | format_string | ) | const |
Processes the given string to extrapolate the format for Apache2.
- Parameters
-
format_string The format string to process
- Returns
- The logs format
- Exceptions
-
LogFormatException
- See also
- LogsFormat
◆ processIisFormatString()
const FormatOps::LogsFormat FormatOps::processIisFormatString | ( | const std::string & | format_string, |
const int & | log_module | ||
) | const |
Processes the given string to extrapolate the format for the IIS.
- Parameters
-
format_string The format string to process log_module The ID of the log module to use
- Returns
- The logs format
- Exceptions
-
LogFormatException
- See also
- LogsFormat
◆ processNginxFormatString()
const FormatOps::LogsFormat FormatOps::processNginxFormatString | ( | const std::string & | format_string | ) | const |
Processes the given string to extrapolate the format for Nginx.
- Parameters
-
format_string The format string to process
- Returns
- The logs format
- Exceptions
-
LogFormatException
- See also
- LogsFormat
Member Data Documentation
◆ APACHE_ALF
|
private |
< Access logs fields formats
Composed access logs fields formats
The documentation for this class was generated from the following files:
- logdoctor/modules/craplog/modules/formats.h
- logdoctor/modules/craplog/modules/formats.cpp
Generated by 1.9.5 </html>