Skip to content

Commit 86a5f71

Browse files
committed
Log Generator Stress Test Improvements
version 3.2.5 - 02/06/2025 - Log Generator Stress Test Improvements - see changelog
1 parent 03efd6e commit 86a5f71

File tree

7 files changed

+302
-251
lines changed

7 files changed

+302
-251
lines changed

.github/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- version 2.1.6 - 01/09/2025 - repository name change - ApacheLogs2MySQL to apache-logs-to-mysql
1212
- version 3.0.0 - 01/28/2025 - IP Geolocation integration, several table & column renames, many process refinements
1313
- version 3.2.0 - 02/01/2025 - MariaDB compatible and Log Rotation
14+
- version 3.2.5 - 02/06/2025 - Log Generator Stress Test Improvements
1415
- [1.0.1] apache_logs.error_systemCodeID corrected line - INTO logsystemCode to INTO logsystemCodeID
1516
- [1.0.1] remove debugging - SELECT statement from apache_logs.process_access_import, process_error_import & normalize_useragent.
1617
- [1.0.1] remove whitespace and commented out old code on all stored programs
@@ -108,4 +109,10 @@
108109
- [3.2.0] modify Store Function `apache_logs`.`importFileExists` for Log File Rotation functionality.
109110
- [3.2.0] modify Store Function `apache_logs`.`importProcessID` for compatibility with MariaDB.
110111
- [3.2.0] add Python function `def copy_backup_file(log_path_file, log_days)` to reuse log file copy and delete functionality,
111-
- [3.2.0] add log summary to end of Python `processLogs` in `logs2mysql.py` to provide more process information to PM2 logs.
112+
- [3.2.0] add log summary to end of Python `processLogs` in `logs2mysql.py` to provide more process information to PM2 logs.
113+
- [3.2.5] modify `process_access_import` to correct `remoteLogName` and `remoteUser` column processing. Values were switched in tables stored. Running log generator stress tests flushed this out.
114+
- [3.2.5] modify `logs2mysql.py` to add timing variables for all child processes to display in logs and store to `import_load` TABLE.
115+
- [3.2.5] modify TABLE `import_load` added six columns for process execution durations in seconds.
116+
- [3.2.5] modify `logs2mysql.py` reworked all process message logging verbiage to provide child process summary information at each phase. Running log generator stress tests flushed this out.
117+
- [3.2.5] modify `logs2mysql.py` reduced number of cursor objects created by reusing only two cursor objects. Reduced all variables for import_file TABLE processing using same variables for all.
118+
- [3.2.5] modify TABLES `access_log_useragent` and `log_client` added indexes for use in `logs2mysql.py` processing.

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ To contribute Ideas or Comments please create a `New discussion` under repositor
44

55
To contribute Apache Access or Error Log Formats commonly used that application should process please start `New discussion`.
66

7-
Any organizations, people or person with multiple Apache servers that find application a godsend in log collection monetary contributions are appreciated. Repository has my ***Buy Me a Coffee*** & ***Venmo*** links.
7+
Any organizations, people or person with multiple Apache servers that find application a godsend in log collection monetary contributions are appreciated. Repository has my ***Buy Me a Coffee*** link.
88

99
Monetary contributions made will be reflected in development of [Web Interface](https://github.com/WillTheFarmer/mysql-to-apache-echarts) for this MySQL `apache_logs` schema.

.github/FUNDING.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
buy_me_a_coffee: WillTheFarmer
2-
custom: [www.venmo.com/u/WillTheFarmer]
1+
buy_me_a_coffee: WillTheFarmer

.github/color.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Terminal color definitions
1+
# Terminal color definitions - 02/06/2025
22
class fg:
33
BLACK = '\033[30m'
44
RED = '\033[31m'
@@ -24,7 +24,6 @@ class fg:
2424
LIGHT_CYAN = "\033[1;36m"
2525
LIGHT_WHITE = "\033[1;37m"
2626
RESET = '\033[39m'
27-
2827
class bg:
2928
BLACK = '\033[40m'
3029
RED = '\033[41m'
@@ -35,7 +34,6 @@ class bg:
3534
CYAN = '\033[46m'
3635
WHITE = '\033[47m'
3736
RESET = '\033[49m'
38-
3937
class style:
4038
BRIGHT = '\033[1m'
4139
DIM = '\033[2m'

apache_logs_schema.sql

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
-- # See the License for the specific language governing permissions and
1111
-- # limitations under the License.
1212
-- #
13-
-- # version 3.2.0 - 02/01/2025 - MariaDB compatible and Log Rotation - see changelog
13+
-- # version 3.2.5 - 02/06/2025 - Log Generator Stress Test Improvements - see changelog
1414
-- #
1515
-- # Copyright 2024-2025 Will Raymond <[email protected]>
1616
-- #
@@ -701,6 +701,7 @@ CREATE TABLE `access_log_useragent` (
701701
KEY `F_useragent_ua_os` (`uaosid`),
702702
KEY `F_useragent_ua_os_family` (`uaosfamilyid`),
703703
KEY `F_useragent_ua_os_version` (`uaosversionid`),
704+
KEY `I_access_log_useragent_ua` (`ua`),
704705
CONSTRAINT `F_useragent_ua` FOREIGN KEY (`uaid`) REFERENCES `access_log_ua` (`id`),
705706
CONSTRAINT `F_useragent_ua_browser` FOREIGN KEY (`uabrowserid`) REFERENCES `access_log_ua_browser` (`id`),
706707
CONSTRAINT `F_useragent_ua_browser_family` FOREIGN KEY (`uabrowserfamilyid`) REFERENCES `access_log_ua_browser_family` (`id`),
@@ -2343,7 +2344,7 @@ CREATE TABLE `import_format` (
23432344

23442345
LOCK TABLES `import_format` WRITE;
23452346
/*!40000 ALTER TABLE `import_format` DISABLE KEYS */;
2346-
INSERT INTO `import_format` VALUES (1,'common',NULL,'2025-02-01 14:10:10'),(2,'combined',NULL,'2025-02-01 14:10:10'),(3,'vhost',NULL,'2025-02-01 14:10:10'),(4,'csc2mysql',NULL,'2025-02-01 14:10:10'),(5,'error_default',NULL,'2025-02-01 14:10:10'),(6,'error_vhost',NULL,'2025-02-01 14:10:10');
2347+
INSERT INTO `import_format` VALUES (1,'common',NULL,'2025-02-06 01:56:10'),(2,'combined',NULL,'2025-02-06 01:56:10'),(3,'vhost',NULL,'2025-02-06 01:56:10'),(4,'csc2mysql',NULL,'2025-02-06 01:56:10'),(5,'error_default',NULL,'2025-02-06 01:56:10'),(6,'error_vhost',NULL,'2025-02-06 01:56:10');
23472348
/*!40000 ALTER TABLE `import_format` ENABLE KEYS */;
23482349
UNLOCK TABLES;
23492350

@@ -2359,25 +2360,35 @@ CREATE TABLE `import_load` (
23592360
`importclientid` int NOT NULL,
23602361
`errorFilesFound` int DEFAULT NULL,
23612362
`errorFilesLoaded` int DEFAULT NULL,
2363+
`errorRecordsLoaded` int DEFAULT NULL,
23622364
`errorParseCalled` tinyint DEFAULT NULL,
23632365
`errorImportCalled` tinyint DEFAULT NULL,
2366+
`errorSeconds` int DEFAULT NULL,
23642367
`combinedFilesFound` int DEFAULT NULL,
23652368
`combinedFilesLoaded` int DEFAULT NULL,
2369+
`combinedRecordsLoaded` int DEFAULT NULL,
23662370
`combinedParseCalled` tinyint DEFAULT NULL,
23672371
`combinedImportCalled` tinyint DEFAULT NULL,
2372+
`combinedSeconds` int DEFAULT NULL,
23682373
`vhostFilesFound` int DEFAULT NULL,
23692374
`vhostFilesLoaded` int DEFAULT NULL,
2375+
`vhostRecordsLoaded` int DEFAULT NULL,
23702376
`vhostParseCalled` tinyint DEFAULT NULL,
23712377
`vhostImportCalled` tinyint DEFAULT NULL,
2378+
`vhostSeconds` int DEFAULT NULL,
23722379
`csv2mysqlFilesFound` int DEFAULT NULL,
23732380
`csv2mysqlFilesLoaded` int DEFAULT NULL,
2381+
`csv2mysqlRecordsLoaded` int DEFAULT NULL,
23742382
`csv2mysqlParseCalled` tinyint DEFAULT NULL,
23752383
`csv2mysqlImportCalled` tinyint DEFAULT NULL,
2384+
`csv2mysqlSeconds` int DEFAULT NULL,
23762385
`userAgentRecordsParsed` int DEFAULT NULL,
23772386
`userAgentNormalizeCalled` tinyint DEFAULT NULL,
2387+
`userAgentSeconds` int DEFAULT NULL,
23782388
`ipAddressRecordsParsed` int DEFAULT NULL,
23792389
`ipAddressNormalizeCalled` tinyint DEFAULT NULL,
2380-
`errorOccurred` tinyint DEFAULT NULL,
2390+
`ipAddressSeconds` int DEFAULT NULL,
2391+
`errorOccurred` int DEFAULT NULL,
23812392
`processSeconds` int DEFAULT NULL,
23822393
`started` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
23832394
`completed` datetime DEFAULT NULL,
@@ -2413,7 +2424,7 @@ CREATE TABLE `import_process` (
24132424
`records` int DEFAULT NULL,
24142425
`files` int DEFAULT NULL,
24152426
`loads` int DEFAULT NULL,
2416-
`errorOccurred` tinyint DEFAULT NULL,
2427+
`errorOccurred` int DEFAULT NULL,
24172428
`processSeconds` int DEFAULT NULL,
24182429
`started` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
24192430
`completed` datetime DEFAULT NULL,
@@ -2687,6 +2698,7 @@ CREATE TABLE `log_client` (
26872698
KEY `F_log_client_network` (`networkid`),
26882699
KEY `F_log_client_organization` (`organizationid`),
26892700
KEY `F_log_client_subdivision` (`subdivisionid`),
2701+
KEY `I_log_client_country_code` (`country_code`),
26902702
CONSTRAINT `F_log_client_city` FOREIGN KEY (`cityid`) REFERENCES `log_client_city` (`id`),
26912703
CONSTRAINT `F_log_client_coordinate` FOREIGN KEY (`coordinateid`) REFERENCES `log_client_coordinate` (`id`),
26922704
CONSTRAINT `F_log_client_country` FOREIGN KEY (`countryid`) REFERENCES `log_client_country` (`id`),
@@ -6637,8 +6649,8 @@ INNER JOIN apache_logs.import_file f
66376649
IF in_processName = 'csv2mysql' AND importLoad_ID IS NULL THEN
66386650
FETCH csv2mysqlStatus INTO
66396651
client,
6640-
remoteUser,
66416652
remoteLogName,
6653+
remoteUser,
66426654
logTime,
66436655
bytesReceived,
66446656
bytesSent,
@@ -6665,8 +6677,8 @@ INNER JOIN apache_logs.import_file f
66656677
ELSEIF in_processName = 'csv2mysql' THEN
66666678
FETCH csv2mysqlLoadID INTO
66676679
client,
6668-
remoteUser,
66696680
remoteLogName,
6681+
remoteUser,
66706682
logTime,
66716683
bytesReceived,
66726684
bytesSent,
@@ -6693,8 +6705,8 @@ INNER JOIN apache_logs.import_file f
66936705
ELSEIF in_processName = 'vhost' AND importLoad_ID IS NULL THEN
66946706
FETCH vhostStatus INTO
66956707
client,
6696-
remoteUser,
66976708
remoteLogName,
6709+
remoteUser,
66986710
logTime,
66996711
reqBytes,
67006712
reqStatus,
@@ -6713,8 +6725,8 @@ INNER JOIN apache_logs.import_file f
67136725
ELSEIF in_processName = 'vhost' THEN
67146726
FETCH vhostLoadID INTO
67156727
client,
6716-
remoteUser,
67176728
remoteLogName,
6729+
remoteUser,
67186730
logTime,
67196731
reqBytes,
67206732
reqStatus,
@@ -6733,8 +6745,8 @@ INNER JOIN apache_logs.import_file f
67336745
ELSEIF in_processName = 'combined' AND importLoad_ID IS NULL THEN
67346746
FETCH combinedStatus INTO
67356747
client,
6736-
remoteUser,
67376748
remoteLogName,
6749+
remoteUser,
67386750
logTime,
67396751
reqBytes,
67406752
reqStatus,
@@ -6753,8 +6765,8 @@ INNER JOIN apache_logs.import_file f
67536765
ELSE
67546766
FETCH combinedLoadID INTO
67556767
client,
6756-
remoteUser,
67576768
remoteLogName,
6769+
remoteUser,
67586770
logTime,
67596771
reqBytes,
67606772
reqStatus,

0 commit comments

Comments
 (0)