# Small userid module change

**URL:** <https://www.ruby-forum.com/t/small-userid-module-change/203652>\
**Category:** NGINX\
**Created:** [February 24, 2011, 1:39pm UTC](https://www.ruby-forum.com/t/small-userid-module-change/203652 "2011-02-24T13:39:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 24, 2011, 1:39pm UTC](https://www.ruby-forum.com/t/small-userid-module-change/203652/1 "2011-02-24T13:39:30Z")

</div>

Hello list!

I wanted to use my nginx logs to power click track analysis like  
[http://statviz.sourceforge.net/](http://statviz.sourceforge.net/) for example, and therefore I used the  
userid module.

I realized quickly that it either sets $uid\_set or $uid\_got, never  
both, which makes it hard to get one single column in the logfile that  
entails the userid.

So I devised the following patch for this purpose:

-----------------------------------8\<--------------------------------------------  
— nginx-0.7.67/src/http/modules/ngx\_http\_userid\_filter\_module.c  
2010-06-07  
11:54:19.000000000 +0200  
+++  
nginx-0.7.67-martin//src/http/modules/ngx\_http\_userid\_filter\_module.c  
2011-02-24  
13:16:20.000000000 +0100  
@@ -275,9 +275,11 @@

```
 ctx = ngx_http_get_module_ctx(r, ngx_http_userid_filter_module);

```

- if (ctx == NULL || ctx-\>uid\_set[3] == 0) {
- 

```
   v->not_found = 1;

```

- 

```
   return NGX_OK;

```

- if (ctx == NULL) {

- 

```
 v->not_found = 1;

```

- 

```
 return NGX_OK;

```

- } else if (ctx-\>uid\_set[3] == 0) {

- 

```
 return ngx_http_userid_got_variable(r, v, data);

```

}

conf = ngx\_http\_get\_module\_loc\_conf(r,  
ngx\_http\_userid\_filter\_module);  
-----------------------------------8\<--------------------------------------------

Since I have no real ambition to have my own fork of nginx, I would  
love to hear about the possibilities to get this modification, or  
another that solves my problem in a more nginxy way, into the main  
branch.

regards,  
//Martin Bruse
