You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Shailesh N. Humbad" <hu...@gmail.com> on 2006/11/01 17:26:40 UTC

Re: [users@httpd] length of unique_id

> On this page:
> 
> http://httpd.apache.org/docs/2.2/mod/mod_unique_id.html
> 
> it says, "The UNIQUE_ID environment variable is constructed by encoding 
> the 112-bit (32-bit IP address, 32 bit pid, 32 bit time stamp, 16 bit 
> counter) quadruple using the alphabet [A-Za-z0-9@-] in a manner similar 
> to MIME base64 encoding, producing 19 characters."
> 
> However, in the log files of my new server, the Unique ID is always 24 
> characters.  Am I missing something?
> 
> I enabled mod_unique_id and put it in my LogFormat like this 
> "%{UNIQUE_ID}e".  I have Apache 2.2.3 on FreeBSD 6.0.  The length is not 
> causing me any problems, I just want to know if something was changed.
> 

I think I figured it out.

In 2.2.3 mod_unique_id.c, the unique_id structure is defined as:

typedef struct {
     unsigned int stamp;
     unsigned int in_addr;
     unsigned int pid;
     unsigned short counter;
     unsigned int thread_index;
} unique_id_rec;

In 1.3.36 mod_unique_id.c, the unique_id structure is defined as:

typedef struct {
     unsigned int stamp;
     unsigned int in_addr;
     unsigned int pid;
#ifdef MULTITHREAD
     unsigned int tid;
#endif
     unsigned short counter;
} unique_id_rec;

My old Apache version did not have MULTITHREAD defined in the build 
options (found by running httpd -V).  In Apache 2.0+, multi-threading is 
enabled by default.  Thus, the old structure is 112 bits (divide by 6 to 
get psuedo-UUencoded base64 value), or 19 characters.  The new structure 
(or the old one with multi-threading) is 144 bits, which translates to 
24 characters.  Therefore, in all 2.0+ versions of Apache on typical 
32-bit systems, the UniqueID will be 24 characters.  However, it will 
still vary based on the size of integral types on the host system.

I want to eventually store the UniqueID in a MySQL Archive table.  It 
helps to know the fixed size for the the field in the table.

Maybe this can be made more clear in the documentation?

Sincerely,
Shailesh







---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org