Last active
April 22, 2020 01:37
-
-
Save anytizer/30c315ddfdb0fc703adcace9983497a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE test; | |
DROP TABLE IF EXISTS apache_logs; | |
CREATE TABLE apache_logs ( | |
log_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Log ID', | |
processing_time INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Processing time in milliseconds', | |
http_status INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'HTTP status code', | |
request_method VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Request URL (GET/POST)', | |
access_url TEXT NOT NULL COMMENT 'URLs accessed', | |
PRIMARY KEY (log_id) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule log_config_module> | |
LogFormat "%D %>s %m %U%q" urlsdetails | |
CustomLog "logs/access-urls-details.log" urlsdetails | |
</IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TRUNCATE apache_logs; | |
-- Load the Apache Log into MySQL Database | |
-- You may use full path eg: C:\\xampp\\apache\\logs\\access-urls-details.log | |
LOAD DATA LOCAL INFILE 'access-urls-details.log' | |
INTO TABLE apache_logs | |
FIELDS ESCAPED BY '\\' TERMINATED BY ' ' | |
LINES TERMINATED BY '\r\n' (processing_time, http_status, request_method, access_url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM apache_logs; | |
SELECT * FROM apache_logs ORDER BY processing_time DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment