Custom access log nginx9/17/2023 ![]() In comparison, this can be done in Apache via: LogFormat ". For example, I use register_shutdown_function() in PHP to log the processing time.Īs an aside, if you did just want the processing time, then $upstream_response_time might be useful. Access logs can reveal a visitors location, the page they view, the amount of time they spend on the page, and much more. In nginx, we capture this header and write to accesslog for debug, monitor, route request. Each event record includes a timestamp as well as different details about the client and the resource requested. Sample, send a deviceid header to server. Where you should probably use proxy_hide_header to stop those headers being sent to the client.īut this header based approach doesn't work if the headers have already been sent. Configuring the Access Log Nginx creates a new event in the access log whenever a client request is handled. One possibility is to set a header in PHP, and then use $sent_http_XXX: log_format inc_info '.' Īccess_log /var/log/nginx/access.log inc_info ![]() With the log_format its possible to include a range of variables such as $http_user_agent:īut is it possible to include a variable from PHP-FPM?įor example, I would like to include the User ID and timing information in the access_log.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |