Hey use the following steps to log the X-Amzn-Trace_Id header:
1. Open the Apache configuration file ( /etc/httpd/conf/httpd.conf in Amazon Linux) in your preferred text editor.
2. In the LogFormat section, add the option %{X-Amzn-Trace-Id}i as follows:
LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b %D \"%{Referer}i\" \"%{User-Agent}i\" \"%{X-Amzn-Trace-Id}i\"" combined
3. Restart the Apache service to apply your changes as follows:
sudo service apache restart