memc-nginx-module icon indicating copy to clipboard operation
memc-nginx-module copied to clipboard

memc upstream statistics

Open kayrus opened this issue 12 years ago • 5 comments

Is it possible to collect upstream statistics for memc_pass?

I've created the following location for upstream, but nginx doesn't collect any statistics:

log_format main '$host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" upstream $upstream_response_time TIME: $request_time';

    location /memc {
            internal;
            access_log main;
            set                     $memc_key $arg_key;
            set                     $memc_cmd $arg_cmd;
            set                     $memc_value $arg_val;
            set                     $memc_flags $arg_flags;
            set                     $memc_exptime $arg_exptime;

            memc_cmds_allowed       get set;
            memc_pass               memc;
    }

kayrus avatar Apr 23 '13 14:04 kayrus

I think you need to turn on the log_subrequest directive in your nginx.conf. See

http://wiki.nginx.org/HttpCoreModule#log_subrequest

Best regards, -agentzh

agentzh avatar Apr 23 '13 18:04 agentzh

Unfortunately it doesn't work.

kayrus avatar Apr 24 '13 05:04 kayrus

Hello!

On Tue, Apr 23, 2013 at 10:13 PM, kayrus [email protected] wrote:

Unfortunately it doesn't work.

It should work as long as you put the "log_subrequest on;" line at the right position. To be safe, you can just put it in the server {} block directly.

-agentzh

agentzh avatar Apr 24 '13 05:04 agentzh

BTW, you're using the "access_log" directive in the wrong way. See the documentation for its usage:

http://wiki.nginx.org/HttpLogModule#access_log

That is, instead of writing

access_log main;

You should really write

access_log logs/access.log main;

Otherwise nginx will just log into the file named "main" in the current working directory, with the default "combined" format.

agentzh avatar Apr 24 '13 05:04 agentzh

My bad =) Thanks! It works now.

kayrus avatar Apr 24 '13 05:04 kayrus