InfoHeap
Tech tutorials, tips, tools and more
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Apache tutorials

  • AWStats on Ubuntu
  • ApacheBench - load testing
  • Auth to a location or directory
  • Block directory access using htaccess 404
  • Different expire Headers for multiple images
  • Disable directory listing
  • List loaded modules
  • Log Content-Type in access log
  • Log latency and host in apache log
  • Monitoring using mod_status
  • Python to analyze bots in logs
  • Remove php extension from url
  • egrep and access log
  • log custom data in apache access log
  • mod_rewrite
  • top IP list from access log
 
  • Home
  • > Tutorials
  • > Web Development
  • > Apache

How to log page latency and url host in apache log

By admin | Last updated on Jan 13, 2016

Apache log can give you lot of insight into the performance of your site. The default configuration of apache does not log the page serving time and url host name in apache log. Here is the apache configuration which can be used for logging server page serving time and url host name.

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"V:%V D:%D\"" mycombined

This appends an extra field in apache log containing page serving time (after “D:”) and url host field “V:”. The host field is pretty handy if you are hosting multiple sites on same machine. It also helps you identify if there are duplicate pages with www and non-www domains.

Once you have configured the log format (we named it mycombined above) you can use the following config in your virtual host configuration

<VirtualHost *:80>
...
CustomLog "|/usr/sbin/rotatelogs /etc/httpd/logs/myaccess_log.%Y-%m-%d 86400" mycombined
</VirtualHost>

Some points to note

  1. The page serving time is only from server perspective. It does not include the network latency, browser rendering time, etc.
  2. Usually a latency of more than 500 milliseconds points to some problem somewhere.
  3. You should not have presence of both www and non-www in apache log. In case you are using non-www domain for your site, you should redirect www domain to non-www domain.

Suggested posts:

  1. Why and how to log Content-Type in apache access log
  2. Using python to analyze bots from apache logs
  3. How to setup svn repository on AWS Ubuntu Linux with apache simple auth
  4. PHP – How to log custom data in apache access log
  5. How to migrate your site from one domain to another
  6. Monitor apache using mod_status on Ubuntu
  7. Command line – top IP list from apache access log
  8. ApacheBench (ab) – how to load test a web site
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Apache, Linux, Tutorials, Ubuntu Linux

Follow InfoHeap

facebook
twitter
googleplus
  • Browse site
  • Article Topics
  • Article archives
  • Recent Articles
  • Contact Us
  • Omoney
Popular Topics: AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries

Copyright © 2022 InfoHeap.

Powered by WordPress