LogDoctor/docs/html/classFormatOps.html

34 KiB

<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> <head> </head>
LogDoctor 2.00
Parse Apache2/Nginx/IIS logs and create statistics
Loading...
Searching...
No Matches

FormatOps. More...

#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

FormatOps.

Operations for the logs formats

Member Function Documentation

◆ checkIisString()

void FormatOps::checkIisString ( const std::string &  string) const
private

Checks whether the format string contains invalid characters or not.

Parameters
stringThe format string
Exceptions
LogFormatException
See also
processIisFormatString

◆ countNewLines()

const unsigned FormatOps::countNewLines ( const std::string &  initial,
const std::string &  final,
const std::vector< std::string > &  separators 
) const
private

Conuts how many new lines are there in the format.

Used to join log lines which refer to the same log line

Parameters
initialThe initial separator
finalThe final separator
separatorsThe separators in the middle
Returns
The number of new lines in a single log line
See also
LogsFormat, processApacheFormatString(), processNginxFormatString()

◆ findNginxFieldEnd()

const size_t FormatOps::findNginxFieldEnd ( const std::string &  string,
const int  start 
) const
private

Finds the end of a Nginx log field.

Parameters
stringThe format string
startThe 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_formatThe 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_formatThe 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_formatThe logs format to use to build the sample
Returns
The sample line
See also
LogsFormat, Craplog::getLogsFormatSample()

◆ parseApacheEscapes()

const std::string FormatOps::parseApacheEscapes ( const std::string &  string,
const bool  strftime = false 
) const
private

Parses the escapes (backslashes) and returns the resulting string.

Used to obtain the same result as on Apache2

Parameters
stringThe string to parse
strftimeWhether to apply the strftime special rule when parsing or not
Returns
The resulting string
Exceptions
LogFormatException
See also
processApacheFormatString()

◆ parseNginxEscapes()

const std::string FormatOps::parseNginxEscapes ( const std::string &  string) const
private

Parses the escapes (backslashes) and returns the resulting string.

Used to obtain the same result as on Nginx

Parameters
stringThe 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_stringThe 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_stringThe format string to process
log_moduleThe 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_stringThe format string to process
Returns
The logs format
Exceptions
LogFormatException
See also
LogsFormat

Member Data Documentation

◆ APACHE_ALF

const std::unordered_map<std::string, std::string> FormatOps::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 doxygen 1.9.5 </html>