An open API service indexing awesome lists of open source software.

https://github.com/vcputtini/squidlogparser

A small object library capable of interpreting the log entries generated by Squid-cache(tm) and manipulating this data.
https://github.com/vcputtini/squidlogparser

cpp cpp17 http http-proxy https lib library parser squid squid-proxy

Last synced: 3 months ago
JSON representation

A small object library capable of interpreting the log entries generated by Squid-cache(tm) and manipulating this data.

Awesome Lists containing this project

README

        

## SquidLogParser
This library is a basic one for analyzing and retrieving information from the fields of the Squid-cache(tm) log entries.

Currently only internally predefined formats are supported: squid; common; combined; referrer and useragent.

This is not a generic library and has not been tested in environments other than the one used in its development.

SquidLogParser was coded entirely in C++.

As I consider QtCreator(tm) to be an excellent development environment,

I use it for my projects, even if these don't directly involve using the Qt(tm) tools.

### Dependencies for Compilation:
- At least C++17.

- Boost

- Tinyxml-2

- MariaDB Connector C++ 1.0.1 or greater for SLPDatabase (Optional)

### My Environment
- Fedora 36

- clang version 14.0.0

- g++ (GCC) 12.1.1 20220507 (Red Hat 12.1.1-1)

(Under Oracle Linux 8 install gcc-devtool-10 or 8.6 install gcc-devtool-11)

- cmake version 3.22.x

- QtCreator 7.0.x (Code Style: clang-format -style=Mozilla)

### Examples

Small programs are provided with examples in the 'examples/' folder of this project.

### Basic Operations

- Loads entire log file into memory and check that the log entries are with the correct format;
- Allows query of log entries given a condition or regex.

- Allows export of log entries to a XML file format.

- (NEW) Allows export log entries to tables in a MariaDB(tm) database.
The tables are preconfigured by the object. See
[README_SLPDatabase](./README_SLPDatabase.md) for more details.

### Objects

- SquidLogParser
- Constructor
- explicit SquidLogParser(LogFormat log_fmt_ )
- Public Members
- append()
- errNum()
- getErrorText()
- size()
- clear()
- getPartInt()
- getPartUint()
- getPartStr()
- addrToNumeric()
- numericToAddr()
- unixTimestamp()
- unixToSquidDate()
- toXML()
- ShowDecodedUrl(URL)

- SLPQuery
- Constructor
- explicit SLPQuery(SquidLogParser* obj_);
- Public Members
- select()
- field()
- getInt()
- getUInt()
- getStr()
- sumTotalSizeReply()
- sumResponseTime()
- countByReqMethod()
- countByHttpCdodes()
- HttpRequestCodes_V getHRCDetails()
- countByFiletype()
- getIndexByFiletype()
- getFTDetails()
- numFiletypes()
- totalFiles()
- MethodText()
- size()
- clear()
- ShowDecodedUrl(URL)

- SLPDatabase
- Constructor
- explicit SLPDatabase(LogFormat format_, const std::string& dbase_, const std::string& host_, const int& port_, const std::string& user_, const std::string& pass_, const std::string& table_);
- Public Members
- insert()
- dataIngest()
- createTable(bool)
- getRowsInserted()
- resetRowsInserted()
- errorNum()
- getErrorText()

- SLPUrlParts
- Constructor
- explicit SLPUrlParts(const std::string rawUrl_);
- Public Members
- getScheme()
- getDomain()
- getUsername()
- getPassword()
- getPath()
- getQuery()
- getFragment()