What is the default apache2 log format and where is defined such default?

For Ubuntu 16.04, you can find the global configuration file here:

/etc/apache2/apache2.conf

Therein it defines some LogFormat directives.

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

The out-of-the-box virtual host configuration file is here:

/etc/apache2/sites-available/000-default.conf

And inside you will find that it declares:

CustomLog ${APACHE_LOG_DIR}/access.log combined

The combined alias refers to the second LogFormat in the aforementioned global config:

"%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\""

It is clearly stated in the documetation for the TransferLog statement:

This directive has exactly the same arguments and effect as the CustomLog directive, with the exception that it does not allow the log format to be specified explicitly or for conditional logging of requests. Instead, the log format is determined by the most recently specified LogFormat directive which does not define a nickname. Common Log Format is used if no other format has been specified.

Go on to the LogFormat statement:

Default: LogFormat "%h %l %u %t \"%r\" %>s %b"

So if a TransferLog statement is given without any LogFormat statement the output format is as described above.

If also the TransferLog statment is missing no access log is written.


Default LogFormat is indeed really

Default: LogFormat "%h %l %u %t \"%r\" %>s %b"

But the log format apache uses by default (on Debian distro at least) is:

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