https://news.ycombinator.com/item?id=10695305 ^ Here is my comment on a previous post for how I am logging all of my bash history in a logical manner (keeping track of terminals and timestamps, etc.) to an sqlite database.
Here are a few other projects:
https://github.com/thenewwazoo/bash-history-sqlite # simple shell script to store Bash history into SQLite3 database
https://gist.github.com/pklaus/1e381be8592426568df9 # simple Python script to store Bash history into Pandas dataframe
https://gist.github.com/pklaus/26925cfa1fc6b370e043 # simple Python script to store Bash history in SQLite3 database
https://github.com/fredsmith/history-db # store Bash history in PHP/MySQL web server
https://github.com/joshuacronemeyer/shellsink # store Bash/Zsh history in Python web server