{"id":19593,"date":"2015-06-17T23:46:12","date_gmt":"2015-06-17T18:16:12","guid":{"rendered":"https:\/\/tothenewco.pro\/blog\/?p=19593"},"modified":"2015-06-17T23:46:12","modified_gmt":"2015-06-17T18:16:12","slug":"php5-fpm-logging","status":"publish","type":"post","link":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/","title":{"rendered":"PHP5-FPM Logging"},"content":{"rendered":"<p>In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received.<\/p>\n<p>Prerequisites:<\/p>\n<p>Lets have an application that uses the php5-fpm module, in this case, we will use the WordPress Application running on a LEMP stack.<\/p>\n<p>To enable the logs , two files are relevant, namely<br \/>\n<strong><br \/>\ni)\u00a0\/etc\/php5\/fpm\/php-fpm.conf<br \/>\nii) \/etc\/php5\/fpm\/pool.d\/www.conf<\/strong><\/p>\n<p>Firstly, open the first file for editing<\/p>\n<p>[js]vi \/etc\/php5\/fpm\/php-fpm.conf[\/js]<\/p>\n<p>Set the desired location for getting error logs. The line should look like:<br \/>\n<strong>error_log = \/var\/log\/php5\/error.log<\/strong><br \/>\nThen save and exit<\/p>\n<p>Next open the second file for editing<\/p>\n<p>[js] vi \/etc\/php5\/fpm\/pool.d\/www.conf [\/js]<\/p>\n<p>Look for the line containing the location of access.log and set it to the desired path.<br \/>\nex: <strong>access.log = \/var\/log\/php5\/access.log<\/strong><\/p>\n<p>Understanding the access log format:<\/p>\n<p><strong>access.format = %R &#8211; %u %t \\&#8221;%m %r%Q%q\\&#8221; %s %f %{mili}d %{kilo}M %C%%&#8221;<\/strong><\/p>\n<p>%R : remote IP address<br \/>\n%u : remote user (you dont see these two in output of tail -f)<\/p>\n<p>%t : server time of receiving request<br \/>\n%m : method<br \/>\n%r : request uri {Addidtional : %q:if query string exists, %Q: the ? character is query<br \/>\nstring exists }<br \/>\n%s: status response<br \/>\n%f : script filename<br \/>\n%d : time taken to serve request (in mili seconds)<br \/>\n%M : peak memory allocated by php (in kilobytes)<br \/>\n%C : CPU used by request<\/p>\n<p>Example:<\/p>\n<p>[js]<br \/>\n          %t                 %m     %r                   %s          %f                    %d      %M   %C<br \/>\n 17\/May\/2015:09:41:04 +0000 &quot;GET \/wp-admin\/install.php&quot; 200 \/var\/www\/wp-admin\/install.php 218.177 2816 87.09%<br \/>\n[\/js]<\/p>\n<p>The format of the access log can be altered as per desire.<\/p>\n<p>The path for slow log is defined is defined just beneath the block of access logs. Uncomment the line and set the desired path for getting slow logs.<br \/>\n<strong>slowlog = \/var\/log\/php5\/slow.log<\/strong><br \/>\nMake sure to set the request_slowlog_timeout to the desired value. The line should look like :<\/p>\n<p>Ex: <strong>request_slowlog_timeout = 10<\/strong><\/p>\n<p>At the bottom of the file set<br \/>\n<strong>php_admin_value[error_log] = \/var\/log\/php5\/error.log<\/strong>        ##path of error.log<br \/>\n<strong>php_admin_flag[log_errors] = on<\/strong><\/p>\n<p>Create the directory(if it does not exist) where the logs are to be created.<\/p>\n<p>[js]mkdir -p \/var\/log\/php5[\/js]<\/p>\n<p>Restart the php5-fpm service<\/p>\n<p>[js]service php5-fpm restart[\/js]<\/p>\n<p>Henceforth you will start getting the logs at the set path.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the WordPress Application running on a LEMP stack. To enable the [&hellip;]<\/p>\n","protected":false},"author":178,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":33,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-19593","post","type-post","status-publish","format-standard","hentry","category-technology"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Prakashul\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"PHP5-FPM Logging | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"PHP5-FPM Logging | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#article\",\"name\":\"PHP5-FPM Logging | TO THE NEW Blog\",\"headline\":\"PHP5-FPM Logging\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/prakashul\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2015-06-17T23:46:12+05:30\",\"dateModified\":\"2015-06-17T23:46:12+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#webpage\"},\"articleSection\":\"Technology\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#listItem\",\"name\":\"PHP5-FPM Logging\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#listItem\",\"position\":3,\"name\":\"PHP5-FPM Logging\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/prakashul\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/prakashul\\\/\",\"name\":\"Prakashul\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#authorImage\",\"url\":\"https:\\\/\\\/newersworld-sf-static.tothenew.net\\\/prod\\\/profilePicFolder\\\/c96b6a37-578a-4c32-bf49-82aa4b4d37f6_prakashul@tothenew.com.jpg\",\"width\":96,\"height\":96,\"caption\":\"Prakashul\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/\",\"name\":\"PHP5-FPM Logging | TO THE NEW Blog\",\"description\":\"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/php5-fpm-logging\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/prakashul\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/prakashul\\\/#author\"},\"datePublished\":\"2015-06-17T23:46:12+05:30\",\"dateModified\":\"2015-06-17T23:46:12+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"PHP5-FPM Logging | TO THE NEW Blog","description":"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the","canonical_url":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#article","name":"PHP5-FPM Logging | TO THE NEW Blog","headline":"PHP5-FPM Logging","author":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/prakashul\/#author"},"publisher":{"@id":"https:\/\/tothenewco.pro\/blog\/#organization"},"datePublished":"2015-06-17T23:46:12+05:30","dateModified":"2015-06-17T23:46:12+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#webpage"},"isPartOf":{"@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#webpage"},"articleSection":"Technology"},{"@type":"BreadcrumbList","@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog#listItem","position":1,"name":"Home","item":"https:\/\/tothenewco.pro\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/tothenewco.pro\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#listItem","name":"PHP5-FPM Logging"},"previousItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#listItem","position":3,"name":"PHP5-FPM Logging","previousItem":{"@type":"ListItem","@id":"https:\/\/tothenewco.pro\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/tothenewco.pro\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/tothenewco.pro\/blog\/"},{"@type":"Person","@id":"https:\/\/tothenewco.pro\/blog\/author\/prakashul\/#author","url":"https:\/\/tothenewco.pro\/blog\/author\/prakashul\/","name":"Prakashul","image":{"@type":"ImageObject","@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#authorImage","url":"https:\/\/newersworld-sf-static.tothenew.net\/prod\/profilePicFolder\/c96b6a37-578a-4c32-bf49-82aa4b4d37f6_prakashul@tothenew.com.jpg","width":96,"height":96,"caption":"Prakashul"}},{"@type":"WebPage","@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#webpage","url":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/","name":"PHP5-FPM Logging | TO THE NEW Blog","description":"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/tothenewco.pro\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/#breadcrumblist"},"author":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/prakashul\/#author"},"creator":{"@id":"https:\/\/tothenewco.pro\/blog\/author\/prakashul\/#author"},"datePublished":"2015-06-17T23:46:12+05:30","dateModified":"2015-06-17T23:46:12+05:30"},{"@type":"WebSite","@id":"https:\/\/tothenewco.pro\/blog\/#website","url":"https:\/\/tothenewco.pro\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/tothenewco.pro\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"PHP5-FPM Logging | TO THE NEW Blog","og:description":"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the","og:url":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/","og:image":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"PHP5-FPM Logging | TO THE NEW Blog","twitter:description":"In this blog i will explain how to configure the access, error and slow logs of php-fpm and to modify the format in which the logs are received. Prerequisites: Lets have an application that uses the php5-fpm module, in this case, we will use the Wordpress Application running on a LEMP stack. To enable the","twitter:image":"https:\/\/tothenewco.pro\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"19593","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 16:24:00","updated":"2024-02-29 09:27:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenewco.pro\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/tothenewco.pro\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPHP5-FPM Logging\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/tothenewco.pro\/blog"},{"label":"Technology","link":"https:\/\/tothenewco.pro\/blog\/category\/technology\/"},{"label":"PHP5-FPM Logging","link":"https:\/\/tothenewco.pro\/blog\/php5-fpm-logging\/"}],"_links":{"self":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/19593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/users\/178"}],"replies":[{"embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/comments?post=19593"}],"version-history":[{"count":0,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/posts\/19593\/revisions"}],"wp:attachment":[{"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/media?parent=19593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/categories?post=19593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tothenewco.pro\/blog\/wp-json\/wp\/v2\/tags?post=19593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}