/** * @file log_parsing.h * @author Lew Price (lewis.e.price@outlook.com) * @brief A series of functions for parsing the access logs of an Apache2 webserver. * @version 0.1 * @date 2026-05-28 * * @copyright Copyright (c) 2026 * */ #pragma once #include #include struct Entry { std::string ip; std::string timestamp; std::string request; std::string status; std::string bytes; std::string referer; std::string os; std::string browser; }; class p_logs { private: Entry entry; std::vector logs; std::string url; public: /** * @brief Construct a new parsed logs object * Detailed explanation: This function takes in the absolute path to a .log file and parses the lines into individual "Entry"s. These Entrys are then stored into a vector that can then be accessed via getter functions. * @param string */ p_logs(std::string); /** * @brief Getter function for a specific Entry's IP * * @param int * @return std::string */ std::string entryx_ip(int); /** * @brief Getter function for a specific Entry's time stamp * * @param int * @return std::string */ std::string entryx_timestamp(int); /** * @brief Getter function for a specific Entry's request * * @param int * @return std::string */ std::string entryx_request(int); /** * @brief Getter function for a specific Entry's status * * @param int * @return std::string */ std::string entryx_status(int); /** * @brief Getter function for a specific Entry's byte size * * @param int * @return std::string */ std::string entryx_bytes(int); /** * @brief Getter function for a specific Entry's referer * * @param int * @return std::string */ std::string entryx_referer(int); /** * @brief Getter function for a specific Entry's OS info * * @param int * @return std::string */ std::string entryx_os(int); /** * @brief Getter function for a specific Entry's browser info * * @param int * @return std::string */ std::string entryx_browser(int); /** * @brief Prints all parsed log entries * */ void print_logs(); };