LogDoctor/docs/html/classDbQuery.html

52 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

Public Member Functions

void setDialogLevel (const int &new_level)
 Returns the Dialogs level.
 
void setDbPath (const std::string &path)
 Sets the path for the logs Collection database. More...
 
void refreshDates (std::tuple< bool, std::unordered_map< int, std::unordered_map< int, std::unordered_map< int, std::vector< int > > > > > &result)
 Refreshes the dates which are available in the database. More...
 
void updateWarnings (const QString &web_server, const std::vector< std::tuple< int, int > > &updates)
 Updates the database applying the changes made in the Warnings statistics table. More...
 
void getWarnCounts (std::tuple< bool, std::vector< std::vector< std::vector< std::vector< QString > > > > > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &hour_)
 Retrieves the data needed for the Warnings statistics. More...
 
void getSpeedData (std::tuple< bool, std::vector< std::tuple< long long, std::vector< QString > > > > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &protocol_f, const QString &method_f, const QString &uri_f, const QString &query_f, const QString &response_f)
 Retrieves the data needed for the Speed statistics. More...
 
void getItemsCount (std::tuple< bool, std::vector< std::tuple< QString, int > > > &result, const QString &web_server, const QString &year, const QString &month, const QString &day, const QString &log_field)
 Retrieves the data needed for the Counts statistics. More...
 
void getDaytimeCounts (std::tuple< bool, std::unordered_map< int, std::unordered_map< int, int > > > &result, const QString &web_server, const QString &from_year_, const QString &from_month_, const QString &from_day_, const QString &to_year_, const QString &to_month_, const QString &to_day_, const QString &log_field_, const QString &field_filter)
 Retrieves the data needed for the Daytime statistics. More...
 
void getRelationalCountsDay (std::tuple< bool, std::vector< std::tuple< long long, int > > > &result, const QString &web_server, const QString &year_, const QString &month_, const QString &day_, const QString &log_field_1_, const QString &field_filter_1, const QString &log_field_2_, const QString &field_filter_2)
 Retrieves the data needed for the Relationsl statistics. More...
 
void getRelationalCountsPeriod (std::tuple< bool, std::vector< std::tuple< long long, int > > > &result, const QString &web_server, const QString &from_year_, const QString &from_month_, const QString &from_day_, const QString &to_year_, const QString &to_month_, const QString &to_day_, const QString &log_field_1_, const QString &field_filter_1, const QString &log_field_2_, const QString &field_filter_2)
 Retrieves the data needed for the Relational statistics. More...
 
const bool getGlobalCounts (const QString &web_server, const std::unordered_map< int, std::unordered_map< int, std::vector< int > > > &dates, std::vector< std::unordered_map< QString, int > > &recurs, std::tuple< QString, int > &traf_date, std::unordered_map< int, double > &traf_day, std::unordered_map< int, double > &traf_hour, std::vector< long long > &perf_time, std::vector< long long > &perf_sent, std::vector< long long > &perf_receiv, long &req_count)
 Retrieves the data needed for the Global statistics. More...
 

Private Member Functions

const QString getDbField (const QString &tr_fld)
 Returns the database field corresponding to the relative log field. More...
 
const int getMinuteGap (const int &minute, const int &gap=10)
 Returns the minute gap for the given minute with the given gap. More...
 
const int getMonthDays (const int &year, const int &month)
 Returns the number of days for a given month. More...
 
const int getMonthNumber (const QString &month_str)
 Returns the month number in the year. More...
 
const int getMonthsCount (const int &from_year, const int &from_month, const int &to_year, const int &to_month)
 Returns the number of months in a given period. More...
 

Member Function Documentation

◆ getDaytimeCounts()

void DbQuery::getDaytimeCounts ( std::tuple< bool, std::unordered_map< int, std::unordered_map< int, int > > > &  result,
const QString &  web_server,
const QString &  from_year_,
const QString &  from_month_,
const QString &  from_day_,
const QString &  to_year_,
const QString &  to_month_,
const QString &  to_day_,
const QString &  log_field_,
const QString &  field_filter 
)

Retrieves the data needed for the Daytime statistics.

Parameters
resultTuple which will hold the result of the operation and the data
web_serverThe ID of the Web Server to use
from_year_The initial year
from_month_The initial month
from_day_The initial day
to_year_The final year
to_month_The final month
to_day_The final day
log_field_The log field to filter
field_filterThe filter to apply

◆ getDbField()

const QString DbQuery::getDbField ( const QString &  tr_fld)
private

Returns the database field corresponding to the relative log field.

Parameters
tr_fldThe log field, hendles translated text
Returns
The database field

◆ getGlobalCounts()

const bool DbQuery::getGlobalCounts ( const QString &  web_server,
const std::unordered_map< int, std::unordered_map< int, std::vector< int > > > &  dates,
std::vector< std::unordered_map< QString, int > > &  recurs,
std::tuple< QString, int > &  traf_date,
std::unordered_map< int, double > &  traf_day,
std::unordered_map< int, double > &  traf_hour,
std::vector< long long > &  perf_time,
std::vector< long long > &  perf_sent,
std::vector< long long > &  perf_receiv,
long &  req_count 
)

Retrieves the data needed for the Global statistics.

Parameters
web_serverThe ID of the Web Server to use
datesThe dates to query
recursWill hold the recurrencies of the items
traf_dateWill hold the most trafficked date and the count
traf_dayWill hold the most trafficked day of the week and the count
traf_hourWill hold the most trafficked hour of the day and the count
perf_timeWill hold the overallo time taken
perf_sentWill hold the overall Bytes sent
perf_receivWill hold the overall Bytes received
req_countWill hold the number of requests examined by the query
Returns
Whether the operation has been successful or not

◆ getItemsCount()

void DbQuery::getItemsCount ( std::tuple< bool, std::vector< std::tuple< QString, int > > > &  result,
const QString &  web_server,
const QString &  year,
const QString &  month,
const QString &  day,
const QString &  log_field 
)

Retrieves the data needed for the Counts statistics.

Parameters
resultTuple which will hold the result of the operation and the data
web_serverThe ID of the Web Server to use
yearThe year
monthThe month
dayThe day
log_fieldThe log field

◆ getMinuteGap()

const int DbQuery::getMinuteGap ( const int &  minute,
const int &  gap = 10 
)
private

Returns the minute gap for the given minute with the given gap.

Parameters
minuteThe minute of the hour
gapThe gap used to split the hour
Returns
The gap index
Exceptions
DateTimeException

◆ getMonthDays()

const int DbQuery::getMonthDays ( const int &  year,
const int &  month 
)
private

Returns the number of days for a given month.

Parameters
yearThe year, used to handle leap years
monthThe month
Returns
The number of days
Exceptions
DateTimeException

◆ getMonthNumber()

const int DbQuery::getMonthNumber ( const QString &  month_str)
private

Returns the month number in the year.

Parameters
month_strThe month
Returns
The month number

◆ getMonthsCount()

const int DbQuery::getMonthsCount ( const int &  from_year,
const int &  from_month,
const int &  to_year,
const int &  to_month 
)
private

Returns the number of months in a given period.

Parameters
from_yearThe initial year
from_monthThe initial month
to_yearThe final Year
to_monthThe final month
Returns
The number of months in the period

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
from_yearThe initial year
from_monthThe initial month
to_yearThe final Year
to_monthThe final month
Returns
The number of months in the period
Exceptions
DateTimeException

◆ getRelationalCountsDay()

void DbQuery::getRelationalCountsDay ( std::tuple< bool, std::vector< std::tuple< long long, int > > > &  result,
const QString &  web_server,
const QString &  year_,
const QString &  month_,
const QString &  day_,
const QString &  log_field_1_,
const QString &  field_filter_1,
const QString &  log_field_2_,
const QString &  field_filter_2 
)

Retrieves the data needed for the Relationsl statistics.

Used when querying a single day

Parameters
resultTuple which will hold the result of the operation and the data
web_serverThe ID of the Web Server to use
year_The year
month_The month
day_The day
log_field_1_The first log field to filter
field_filter_1The filter to apply to the first field
log_field_2_The second log field to filter
field_filter_2The filter to apply to the second fiend
See also
getRelationalCountsPeriod()

◆ getRelationalCountsPeriod()

void DbQuery::getRelationalCountsPeriod ( std::tuple< bool, std::vector< std::tuple< long long, int > > > &  result,
const QString &  web_server,
const QString &  from_year_,
const QString &  from_month_,
const QString &  from_day_,
const QString &  to_year_,
const QString &  to_month_,
const QString &  to_day_,
const QString &  log_field_1_,
const QString &  field_filter_1,
const QString &  log_field_2_,
const QString &  field_filter_2 
)

Retrieves the data needed for the Relational statistics.

Used when querying a period of time

Parameters
resultTuple which will hold the result of the operation and the data
web_serverThe ID of the Web Server to use
from_year_The initial year
from_month_The initial month
from_day_The initial day
to_year_The final year
to_month_The final month
to_day_The final day
log_field_1_The first log field to filter
field_filter_1The filter to apply to the first field
log_field_2_The second log field to filter
field_filter_2The filter to apply to the second fiend
See also
getRelationalCountsDay()

◆ getSpeedData()

void DbQuery::getSpeedData ( std::tuple< bool, std::vector< std::tuple< long long, std::vector< QString > > > > &  result,
const QString &  web_server,
const QString &  year_,
const QString &  month_,
const QString &  day_,
const QString &  protocol_f,
const QString &  method_f,
const QString &  uri_f,
const QString &  query_f,
const QString &  response_f 
)

Retrieves the data needed for the Speed statistics.

Parameters
resultTuple which will hold the result of the operation and the data
web_serverThe ID of the Web Server to use
year_The year
month_The month
day_The day
protocol_fThe filter for the Protocol field
method_fThe filter for the Method field
uri_fThe filter for the URI field
query_fThe filter for the Query field
response_fThe filter for the Response field

◆ getWarnCounts()

void DbQuery::getWarnCounts ( std::tuple< bool, std::vector< std::vector< std::vector< std::vector< QString > > > > > &  result,
const QString &  web_server,
const QString &  year_,
const QString &  month_,
const QString &  day_,
const QString &  hour_ 
)

Retrieves the data needed for the Warnings statistics.

Parameters
resultTuple which will hold the result of the operation and the data
web_serverThe ID of the Web Server to use
year_The year
month_The month
day_The day
hour_The hour

◆ refreshDates()

void DbQuery::refreshDates ( std::tuple< bool, std::unordered_map< int, std::unordered_map< int, std::unordered_map< int, std::vector< int > > > > > &  result)

Refreshes the dates which are available in the database.

Parameters
resultTuple which will hold the result of the operation and the data

◆ setDbPath()

void DbQuery::setDbPath ( const std::string &  path)

Sets the path for the logs Collection database.

See also
Crapview::setDbPath()

◆ updateWarnings()

void DbQuery::updateWarnings ( const QString &  web_server,
const std::vector< std::tuple< int, int > > &  updates 
)

Updates the database applying the changes made in the Warnings statistics table.

Parameters
web_serverThe ID of the Web Server to use
updatesThe list of rowids to update and the corresponding warning values

The documentation for this class was generated from the following files:
  • logdoctor/modules/crapview/modules/query.h
  • logdoctor/modules/crapview/modules/query.cpp

Generated by doxygen 1.9.5 </html>