There is a tool for that: GoAccess. It’s an easy to use command line tool to analyze any access log and create beautiful insights.
On macOS you can use HomeBrew to install GoAccess:
brew install goaccess
For other operation systems, please check out the detailed documentation on their website.
The most elegant way is the terminal output. For this, simply type:
goaccess access.log --log-format=COMBINED
Which creates such an output (you can navigate down to see much more details):
You can also create an html file that you can view in your browser:
goaccess access.last.log -o report.last.html --log-format=COMBINED
If your terminal is not using the same language as your log files do, then you might need to set
LC_TIME for a correct parsing of the log files:
LC_TIME="en_US.UTF-8" goaccess access.last.log -o report.last.html --log-format=COMBINED
To learn more about all options, you can check out the documentation of GoAccess.