- Enable RDS logger
- Run some huge operations
- Download each audit log one by one in single folder.
- Run next command to join all logs to single file:
cat * | awk -F "'" 'BEGIN{OFS="'\''"} NF-=1 {$1=""; print $0}' | cut -c2- > all.sql
- Download and run
analyze.sh
.
cat all.sql | awk '{print $1}' | sort | uniq -ic | tr '[:lower:]' '[:upper:]'
Example:
302 COMMIT
87 DELETE
8365 INSERT
8 ROLLBACK
72638 SELECT
1086 SET
6672 SHOW
310 START
3102 UPDATE
3 USE
cat all.sql | grep 'INSERT INTO' | awk '{print $3}' | sort | uniq -ic | sort -h | tail -n 10
cat all.sql | grep 'UPDATE ' | awk '{print $2}' | sort | uniq -ic | sort -h | tail -n 10
cat all.sql | grep 'DELETE FROM' | awk '{print $3}' | sort | uniq -ic | sort -h | tail -n 10
cat all.sql | grep 'SELECT' | grep 'FROM' | awk -F " FROM " '{print $2}' | awk '{print $1}' | sort | uniq -ic | sort -h | tail -n 10