IF statement to control logging to specific files based upon the browser name. Apache 1.3x

This is a discussion on IF statement to control logging to specific files based upon the browser name. Apache 1.3x within the Apache Web Server forums, part of the Web Server and Related Forums category; Goal: Log to specific files based upon the browser name. I noticed that there's a <IfDefine parameter> ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2007
Jim Carlock
 
Posts: n/a
Default IF statement to control logging to specific files based upon the browser name. Apache 1.3x

Goal: Log to specific files based upon the browser name.

I noticed that there's a <IfDefine parameter> statement for the
httpd.conf file. But it seems to be used when defining parameters
on the command-line... unless I'm misreading the documentation.

The documentation states...

$ httpd -DReverseProxy ...

I'm not sure what the $ symbol denotes in the line above, and
the name of the Apache executable is NOT httpd.

Can I get any suggestions on what to read or perhaps an example
of how to accomplish the above stated goals?

Thanks.

--
Jim Carlock
Post replies to the group.


  #2 (permalink)  
Old 01-12-2007
Jim Carlock
 
Posts: n/a
Default Re: IF statement to control logging to specific files based upon the browser name. Apache 1.3x

On 2007-01-12, Jim Carlock asked...
> Can I get any suggestions on what to read or perhaps an example
> of how to accomplish the above stated goals?



"Davide Bianchi" posted...
: First idea: pipe the log into an external program and apply your
: manipulation in the aforementioned program, second idea: just
: dump everything into the log file and apply the separation at the
: rotation of the log (so once a day) or when you analyze the logs.
:
: Exactly why you want separated log files for clients?

Thinking it would be easy to grab the date off the file to get the
last mod date. And I wondered if Apache provided an IF
statement whereby I could log to different files based upon the
client browser name. And I started thinking that an IF statement
could be quite handy inside an .htaccess file or the conf files.

The only IFs I found though involved <IfModule ...> and
<IfDefine ...>. There's only sample listed under the <IfDefine ...>
involved what appeared to be a constant defined at the command
line. The documentation could be more helpful by providing more
examples.

Do you know of a website that provides extra help for Apache
that might be good for searching? I'm getting some garbage sites
when searching for things. And I don't have a list of good Apache
sites.Well, I take that back, the only one currently in the list is...

http://httpd.apache.org/

I recently converted all my logs to get recorded in a comma
delimited, quote encased manner. Although I forsee a problem
if a URL contains an embedded quote. I don't know IF I'll run
into that problem.

Going a little off topic, I ran into a problem with Time Zone
formatting. I couldn't get the abbreviated Time Zone to appear.
So I'm wondering about that issue as well.

How do I define a constant inside of the httpd.conf file?

Do you use Apache to do log rotations? I just noticed rotatelogs
and logresolve in the bin folder. So I'm currently looking over
what these two apps perform.

--
Jim Carlock
Post replies to the group.


  #3 (permalink)  
Old 01-12-2007
shimmyshack
 
Posts: n/a
Default Re: IF statement to control logging to specific files based upon the browser name. Apache 1.3x


Jim Carlock wrote:
> Goal: Log to specific files based upon the browser name.
>
> I noticed that there's a <IfDefine parameter> statement for the
> httpd.conf file. But it seems to be used when defining parameters
> on the command-line... unless I'm misreading the documentation.
>
> The documentation states...
>
> $ httpd -DReverseProxy ...
>
> I'm not sure what the $ symbol denotes in the line above, and
> the name of the Apache executable is NOT httpd.
>
> Can I get any suggestions on what to read or perhaps an example
> of how to accomplish the above stated goals?
>
> Thanks.
>
> --
> Jim Carlock
> Post replies to the group.



I'm with the post-parsing of log files idea from Davide.

Here's how you would detect a user-agent and set an apache
environmental variable. You could then use the presense of this env var
to trigger a script that logs and serves the requested_uri

you could have reg exp like
SetEnvIf User-Agent 2.0.0.1$ firefox2_0_0_1_on
Header add Firefox2_0_0_1 "%D %t" env=firefox2_0_0_1_on

or just a string
SetEnvIf User-Agent "MSIE 6.0" ie6_on
Header add ie6 "%D %t" env=ie6_on

the request would then be rewritten to a script on the basis of whether
this user-agent was present -> which would set the env var for that
request, you would append the QS for this rewrite.
The php/cgi/perl/ruby script would use the requested URI and
Query_String as args to build the data to serve.

It would log the user agent, and serve the data.

However this requires an overhead, I would hope though that your server
would move to a post-parsing of log files, which is more scalable.

  #4 (permalink)  
Old 01-13-2007
Jim Carlock
 
Posts: n/a
Default Re: IF statement to control logging to specific files based upon the browser name. Apache 1.3x

"Davide Bianchi" <davideyeahsure@onlyforfun.net> wrote:
: Still, you haven't explained why you want to do such thing.
: What's the problem you are trying to solve?

My first thoughts involved separating the search engine logs
from humans. The bots go through quite a few pages. And
I'm looking for a ways to reduce the size of the logs. I'm not
sure that I want to completely drop the search engine logs
completely, so I wondered about putting those items into
separate files.

But now, that I've got the logs going into a .csv format,
perhaps building an external application to handle zipping
the files up and moving them...

I probably should have spent the time today by starting my
own app instead of trying to compile someone elses app
(Cronolog).

--
Jim Carlock
Post replies to the group.



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:08 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0