ngx.shared_dict.get_keys usage

Suraj Kumar suraj.kumar at
Wed Aug 6 06:44:10 UTC 2014


I'm trying to use the lua module in combination with ngx.shared.DICT
feature to record some statistics for nginx (and upstreams') health

When I do dict.get_keys(100), I see the following error in nginx error.log:

2014/08/06 06:27:55 [error] 13446#0: *1 lua entry thread aborted: runtime
error: /opt/inmobi/nginx/customlua/logging.lua:56: bad argument #1 to
'get_keys' (userdata expected, got number)
stack traceback:
coroutine 0:
        [C]: in function 'get_keys'
        /opt/inmobi/nginx/customlua/logging.lua:56: in function
        [string "content_by_lua"]:3: in function <[string
"content_by_lua"]:1>, client:, server: , request: "GET /stat2
HTTP/1.1", host: "localhost"

I'm using ngx_openresty version: ngx_openresty/

Could someone please guide me how to use the get_keys method of the shared
dict in nginx/lua?



[1] Much in the spirit of

An Onion is the Onion skin and the Onion under the skin until the Onion
Skin without any Onion underneath.

The information contained in this communication is intended solely for the 
use of the individual or entity to whom it is addressed and others 
authorized to receive it. It may contain confidential or legally privileged 
information. If you are not the intended recipient you are hereby notified 
that any disclosure, copying, distribution or taking any action in reliance 
on the contents of this information is strictly prohibited and may be 
unlawful. If you have received this communication in error, please notify 
us immediately by responding to this email and then delete it from your 
system. The firm is neither liable for the proper and complete transmission 
of the information contained in this communication nor for any delay in its 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list