- Site Check – Web Site Advice - https://www.sitecheck.be -

Modifying Analog to recognize iPod/iPhone

In a previous article [1] I explained how to change the free Analog log analyzer [2] to recognize Windows Vista. Now as I start to develop websites for the iPod Touch and the iPhone, I also wanted to see those user agents in my Analog reports.

Therefore I modified the tree.c source file of the Analog Source as shown below:

    /* Now non-Windows operating systems */
    else if ((c = strstr(whole, "Mac")) != NULL) {
        if((c = strstr(whole, "PPC")) != NULL)
                        *name = "Macintosh:PPC";
                else if ((c = strstr(whole, "Intel")) != NULL)
                        *name = "Macintosh:Intel";
                else if ((c = strstr(whole, "PowerPC")) != NULL)
                        *name = "Macintosh:Classic";
                else if ((c = strstr(whole, "iPod")) != NULL)
                        *name = "Macintosh:iPod";
                else if ((c = strstr(whole, "iPhone")) != NULL)
                        *name = "Macintosh:iPhone";
                 else
                        *name = "Macintosh:Unknown Macintosh";
         }

After compiling and installing Analog again, I get those user agents listed nicely in my Analog reports:

Analog Output

Step by step:

  1. Download the Analog source tarball from the Analog site [2] or HMUG [3] (preferred)
  2. Extract the tarball to a local directory (gunzip analog-6.0.tar.gz ; tar -xvf analog-6.0.tar)
  3. open the Terminal application, cd to the newly created analog directory
  4. find the file src/tree.c and modify it with the correct iPhone/iPod code
  5. type make
  6. type ./install.sh if you downloaded the HMUG port
  7. run Analog and see if iPod’s or iPhone’s have been to your site…