{"id":18010870,"url":"https://github.com/yokawasa/mod_log_slow","last_synced_at":"2025-03-26T14:32:16.613Z","repository":{"id":66860540,"uuid":"234739","full_name":"yokawasa/mod_log_slow","owner":"yokawasa","description":"Apache module for logging of slow requests handling","archived":false,"fork":false,"pushed_at":"2013-05-19T23:47:11.000Z","size":142,"stargazers_count":16,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-21T23:33:50.462Z","etag":null,"topics":["apache","apache-module","c","logging"],"latest_commit_sha":null,"homepage":"http://code.google.com/p/modlogslow/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yokawasa.png","metadata":{"files":{"readme":"README","changelog":"Changelog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-06-23T23:19:22.000Z","updated_at":"2024-10-18T08:51:23.000Z","dependencies_parsed_at":"2023-02-20T13:15:26.835Z","dependency_job_id":null,"html_url":"https://github.com/yokawasa/mod_log_slow","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokawasa%2Fmod_log_slow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokawasa%2Fmod_log_slow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokawasa%2Fmod_log_slow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yokawasa%2Fmod_log_slow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yokawasa","download_url":"https://codeload.github.com/yokawasa/mod_log_slow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245670905,"owners_count":20653449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","apache-module","c","logging"],"created_at":"2024-10-30T02:15:35.103Z","updated_at":"2025-03-26T14:32:16.319Z","avatar_url":"https://github.com/yokawasa.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"/*\n * README\n * mod_log_slow - Logging Slow Request Module for Apache1.3 and Apache2.X\n */\n\n                     _     _                     _\n _ __ ___   ___   __| |   | | ___   __ _     ___| | _____      __\n| '_ ` _ \\ / _ \\ / _` |   | |/ _ \\ / _` |   / __| |/ _ \\ \\ /\\ / /\n| | | | | | (_) | (_| |   | | (_) | (_| |   \\__ \\ | (_) \\ V  V /\n|_| |_| |_|\\___/ \\__,_|___|_|\\___/ \\__, |___|___/_|\\___/ \\_/\\_/\n                     |_____|       |___/_____|\n\n\n====================================================================\n* Introduction\n====================================================================\n\nmod_log_slow is Apache module to provide measures of the time period\nused for handling each request by the current process. Logging is done\nafter processing a request if the request takes more than certain\nperiod of time that you specifiy.\nThe idea of this module comes from MySQL's slow-query-log, and its\nlogging logic is partially based on mod_log_forensic.\n\n\n====================================================================\n* Download\n====================================================================\n\nhttp://code.google.com/p/modlogslow/downloads/list\n\n\n====================================================================\n* Build and Install\n====================================================================\n\n1) extract files from an archive\ntar zxf modlogslow-\u003cVERSION\u003e.tar.gz\ncd modlogslow-\u003cVERSION\u003e\n\n2) open Makefile and modify ap_basedir variable\nvi Makefile\n ap_basedir=/PATH-TO-APACHE-BASE\n\n3) make and install\nmake\nsudo make install\n\n\n====================================================================\n* Configuration Directives\n====================================================================\n\nAll the directives below may be specified as per-server configuration.\n\no LogSlowEnabled\n\n    Description: set \"On\" to enable log_slow, \"Off\" to disable.\n           Default \"Off\"\n    Syntax: LogSlowEnabled On/Off\n    Context: server config, virtual host\n    Status: Extension\n    Module: mod_log_slow\n\no LogSlowLongRequestTime\n\n    Description: Set the limit of request handling time in millisecond.\n           Default \"1000\". Logging is done after processing a request\n           if the request takes more than LogSlowLongRequestTime.\n    Syntax: LogSlowLongRequestTime number(millisecond)\n    Context: server config, virtual host\n    Status: Extension\n    Module: mod_log_slow\n\no LogSlowFileName\n\n    Description: Set the filename of the slow log. The SlowLogFileName\n           directive is used to log requests info that takes more than\n           the time period specified in LogSlowLongRequestTime directive.\n    Syntax: LogSlowFileName filename or pipe\n    Context: server config, virtual host\n    Status: Extension\n    Module: mod_log_slow\n\n    [note]\n    In case of using pipe(\"|\"), followed by the path to a program to receive the log information on its standard input.\n\no LogSlowTimeFormat\n\n    Description: Set the time, in the form given by format, which should\n           be in strftime(3) format. The slow_log's log entries are written\n           in this format. If not set, the log entries are written in\n           Common Log Format(CLF) by default.\n    Syntax: LogSlowTimeFormat timeformat\n    Context: server config, virtual host\n    Status: Extension\n    Module: mod_log_slow\n\n    [example]\n    LogSlowTimeFormat  \"[%Y-%m-%d %H:%M:%S]\"\n    -\u003e  [2009-06-24 00:09:44]\n\no LogSlowBufferedLogs\n\n    Description: set \"On\" to enable buffered logs flush, \"Off\" to disable.\n           Default \"Off\". Of cource if buffered logs option is set \"On\",\n           slow_log is written delayed so as to decrease disk io and thus\n           to lower the load. Only apache2 module supports.\n    Syntax: LogSlowBufferedLogs On/Off\n    Context: server config, virtual host\n    Status: Extension\n    Module: mod_log_slow\n\n====================================================================\n* Logging Format\n====================================================================\n\nSlow log entry is written to the file that specified in LogSlowFileName\ndirective, and the logging is made only after the request processing\nthat takes more than the time period specified in LogSlowLongRequestTime\ndirective.\n\n1) Unique ID\n\nmod_log_slow assigns a unique ID for each log entry, and the ID is\nadded to the log string. If you're using mod_unique_id, its generated\nID will be used as the unique ID.\n\n2) Slow Log Format\n\n\u003cUnique ID\u003e \u003ctime\u003e elapsed: \u003celapsed time\u003e cpu: \u003ccpu usrtime\u003e(usr)/\u003ccpu systime\u003e(sys) pic: \u003cPID\u003e ip: \u003cREMOTE_IP\u003e host: \u003cHOSTNAME\u003e reqinfo: \u003cREQINFO\u003e\n\no \u003cUnique ID\u003e\n    Description: the unique ID assigned for each log entry.\no \u003ctime\u003e (CLF or User Defined Format)\n    Description: the time to occur the log entry.\no \u003celapsed time\u003e (sec)\n    Description: the time took for the request processing.\no \u003ccpu usrtime\u003e (sec)\n    Description: cpu user time used for the request processing.\no \u003ccpu systime\u003e (sec)\n    Description: cpu sys time used for the request processing.\no \u003cPID\u003e\n    Description: the process ID of apache child process.\no \u003cREMOTE_IP\u003e\n    Description: the request's remote ip address.\no \u003cHOSTNAME\u003e\n    Description: the request's hostname.\no \u003cREQINFO\u003e\n    Description: the request information string.\n    Format: \u003cMETHOD\u003e \u003cPATH\u003e \u003cPROTOCOL\u003e\n    ex.  reqinfo: GET /wiki/index.html?foo=val1\u0026bar=val2 HTTP/1.0\n\nlog example)\n3f2b:4a40e871:0 [23/Jun/2009:23:36:33 +0900] elapsed: 0.15 cpu: 0.05(usr)/0.00(sys) pid: 16171 ip: 127.0.0.1 host: localhost:80 reqinfo: GET /wiki/index.html?foo=val1\u0026bar=val2 HTTP/1.0\n\n\n3) Apache Note Info and CustomLog Format\n\nmod_log_slow adds 2 records below in apache request_rec's 'notes'\ntable when the request processing time is slow enough for the slow\nlogging to be make.\n\no Unique ID\n    Description: the unique ID assigned for each log entry.\n    Name: \"logslow-id\"\no Elapsed time\n    Description: the time took for the request processing.\n    Name: \"logslow-time\"\n\nTherefore, you can add the unique ID and the elapsed time info to\nthe \"CustomLog\" by adding the %{logslow-id}n, %{logslow-time}n string\nto log format string of CustomLog directive.\n\nex.\nCustomLog logs/clicklog \"%h %l %u %t \\\"%r\\\" %\u003es %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\" \\\"%{logslow-id}n\\\" \\\"%{logslow-time}n\\\"\"\n\n\n====================================================================\n* Sample Configuration\n====================================================================\n\n1) load module\nLoadModule log_slow_module modules/mod_log_slow.so\n\n2) add directives below\nLogSlowEnabled On\nLogSlowLongRequestTime 100\nLogSlowFileName  /path-to-log/slow_log\nLogSlowTimeFormat \"[%Y-%m-%d %H:%M:%S]\"\nLogSlowBufferedLogs On\n\nsee also: sample.conf\n\n\n====================================================================\n* Authors\n====================================================================\nYoichi Kawasaki \u003cyokawasa@gmail.com\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyokawasa%2Fmod_log_slow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyokawasa%2Fmod_log_slow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyokawasa%2Fmod_log_slow/lists"}