I want to add the 'my_session' cookie value in the Apache error log. I have added an access log 'LogFormat' as below:
<IfModule mod_ssl.c>
<VirtualHost *:443>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" [%{my_session}C : %{UNIQUE_ID}e]" detailed
CustomLog ${APACHE_LOG_DIR}/ssl.www.example.com_access.log detailed
ErrorLogFormat "[%t] [%l] [pid %P] [%{UNIQUE_ID}e] [client %a] %M"
ErrorLog ${APACHE_LOG_DIR}/ssl.www.example.com_error.log
</VirtualHost>
</IfModule>
But when I add the same format in 'ErrorLogFormat' then face the error as Unrecognized error log format directive %C:
ErrorLogFormat "[%t] [%l] [pid %P] [%{my_session}C : %{UNIQUE_ID}e] [client %a] %M"
I used 'mod_unique_id' to get a unique request id.
My requirement is only to add SessionId value/Cookie value in Apache Error Log.