logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: mod_log_mysql, mod_log_sql
Author
SabinF



Joined: 03 May 2006
Posts: 37
Location: Timisoara (Romania)

PostPosted: Sun 13 Aug '06 17:57    Post subject: mod_log_mysql, mod_log_sql Reply with quote

Hi! Does anyone use "mod_log_mysql" or "mod_log_sql" on Windows with Apache 2.2.3? Does it work?
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3092
Location: Hilversum, NL, EU

PostPosted: Tue 15 Aug '06 12:19    Post subject: Reply with quote

You tried ?
Back to top
SabinF



Joined: 03 May 2006
Posts: 37
Location: Timisoara (Romania)

PostPosted: Fri 18 Aug '06 16:07    Post subject: Reply with quote

I tried to compile 'mod_log_sql' to use with Apache 2.2.3 and MySQL 5.0.24, but with no success. Please let me know if anyone can.
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sat 19 Aug '06 17:55    Post subject: Reply with quote

I was able to compile it successfully for Apache 2.2.3 using Visual C++ 2005 Express Edition and the Windows Server 2003 R2 Platform SDK.

This worked for me on Windows 2000 with a MySQL 5.0.21 server on localhost.

I needed to edit build-apache2.bat and change:
    every occurrance of libapr.lib to libapr-1.lib
    every occurrance of libaprutil.lib to libaprutil-1.lib

Of course, I also needed to adjust all the SET commands at the top of build-apache2.bat to point to my correct directories:
Code:
SET DIR_MSSDK=C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2
SET DIR_APACHE=C:\Program Files\Apache Group\Apache223
SET DIR_MYSQL=C:\Program Files\MySQL\MySQL Server 5.0
SET LIB_MYSQL=opt
SET DIR_OPENSSL=C:\work\httpd-2.2.3\srclib\openssl
SET LIB_OPENSSL=VC


Since I built it with VC8 which has .manifest files, I embedded these manifests into the .so files with:
Code:
cd Release
MT -manifest mod_log_sql.so.manifest -outputresource:mod_log_sql.so;2
MT -manifest mod_log_sql_mysql.so.manifest -outputresource:mod_log_sql_mysql.so;2


I haven't load-tested it very thoroughly yet, but it seems to work OK so far.

-tom-
Back to top
someone



Joined: 06 Jul 2006
Posts: 11

PostPosted: Tue 17 Oct '06 6:21    Post subject: I need mod_log_mysql too ! Reply with quote

mod_log_mysql

Could anyone compile or tell a little bit instructions how do I compile it Sad

I need mod_log_mysql.so + mod_log_config.so on Apache 2.2.2 Win. I'm lost in almost everything. E.g. where the hell do I type these "apxs ..." things on windows, it's undefined command? And mod_log_config does not compile at all(build failed) when I'm trying to build it with vs2005 or vc++2005express. And I don't really know how to add mod_log_mysql into the project nor even how to use "apxs" thing, so there's almost nothing I can do. Still original mod_log_config compiled pretty straight and easy..

E.g. this kind of errors it does:
Code:

.\mod_log_config.c(1397) : warning C4002: too many actual parameters for macro 'exit'
.\mod_log_config.c(1397) : error C2059: syntax error : '('
.\mod_log_config.c(1406) : error C2143: syntax error : missing ')' before '*'
.\mod_log_config.c(1406) : error C2143: syntax error : missing '{' before '*'
.\mod_log_config.c(1406) : error C2371: 'apr_pool_t' : redefinition; different basic types


Line 1397 is:
Code:

clsarray[i].writer->exit(s, clsarray[i].writer_data);


I could just commend error lines out but it may not be good..

tdonovan or someone else who seems to be pro in this, could you please gimme some help or provide these .so files?
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Tue 17 Oct '06 16:49    Post subject: Reply with quote

The module that I built was mod_log_sql version 1.100, not mod_log_mysql.
The two .so files in this package are named mod_log_sql.so and mod_log_sql_mysql.so.

The home page is http://www.outoforder.cc/projects/apache/mod_log_sql/
and the source files I used were from http://www.outoforder.cc/downloads/mod_log_sql/mod_log_sql-1.100.tar.bz2.
This is a BZip2-compressed file, so you may need to get the BZip2 utility to uncompress it.
You can get a Windows version of BZip2 at http://gnuwin32.sourceforge.net/packages/bzip2.htm.

Building mod_log_sql for Windows does not require apxs.
This module provides a batch file named build-apache2.bat which you must edit (per my Aug 19 post) and then execute in a command-prompt window.
Note that you must have MySQL installed. If you built Apache with mod_ssl, then you will need the OPENSSL libraries too.

You will need to be sure that your PATH environment includes both the Visual Studio 2005 and the Platform SDK bin directories.
Also, the LIB and INCLUDE environment variables must have correct values.
Visual Studio 2005 provides a file named vsvars32.bat to set these environment variables.

re: "...provide these .so files"
- I use Apache 2.2.3 (from ApacheLounge) and MySQL v5.0.21, but these should also be compatible with Apache 2.2.x and MySQL v5 in general.

If you got Apache 2.2.2 from ApacheLounge, it was built with Microsoft Visual Studio 2005.
You can download http://www.tomdonovan.net/download/mod_log_sql_vs2005.zip.
This was also built with Visual Studio 2005.

If you got Apache 2.2.2 from the Apache download site, it was built with Microsoft Visual C++ 6.
You can download http://www.tomdonovan.net/download/mod_log_sql_vc6.zip.
This was built with Visual C++ 6. It built successfully, but I haven't tested it at all - so test very carefully if you use this one.

The docs for mod_log_sql are at http://www.outoforder.cc/projects/apache/mod_log_sql/docs-2.0/.
An example conf is:
Quote:
LoadModule log_sql_module modules/mod_log_sql.so
LoadModule log_sql_mysql_module modules/mod_log_sql_mysql.so
<IfModule log_sql_module>
LogSQLLoginInfo mysql://username:password@localhost/apachelogs
LogSQLCreateTables on
LogSQLTransferLogTable access_log
LogSQLTransferLogFormat AbcHhmpRSstTUuvz
LogSQLHeadersInLogTable headers_in
LogSQLNotesLogTable notes
</IfModule>


Please post and let us know your results when you get mod_log_sql working.

-tom-
Back to top
someone



Joined: 06 Jul 2006
Posts: 11

PostPosted: Tue 17 Oct '06 22:20    Post subject: Reply with quote

It works, but gives an Application error alert box on every refresh(no crash) saying memory could not be "read". So cannot use it Sad Even when I compiled different versions but always error.

How could I compile mod_log_mysql? That could work. I got new mod_log_config.so compiled just by commenting one line of code(line 1397, see above). Only thing I need is to somehow compile mod_log_mysql.so from mod_log_mysql.c -file. Donno how to use apxs.. donno how to normally compile.. ?
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Wed 18 Oct '06 14:45    Post subject: linking mod_log_mysql Reply with quote

Changing mod_log_mysql so you can build it for Apache 2.2.2 on Windows may take a lot of work.

For example, commenting out line 1397 could cause log entries to be lost.
The function ap_filepipe_log_ewriter_exit at line 1697 will never get called.

If you *really* want to try the code you have changed, you need to compile and link it into shared libraries named mod_log_sql.so and mod_log_config.so.
Here are the commands. Enter each CL command as one long line.
{Apache_root} and {MySQL_root} are the directories where you have installed Apache and MySQL.
Code:
CL /LD /O2 /DWIN32 /D_WINDOWS /I"{Apache_root}\include" /I"{MySQL_root}\include" mod_log_mysql.c /link /OUT:mod_log_mysql.so /LIBPATH:"{Apache_root}\lib" libapr-1.lib libaprutil-1.lib libhttpd.lib  /LIBPATH:"{MySQL_root}\lib\opt" libmysql.lib

CL /LD /O2 /DWIN32 /D_WINDOWS /I"{Apache_root}\include" /I"{MySQL_root}\include" mod_log_config.c /link /OUT:mod_log_config.so /LIBPATH:"{Apache_root}\lib" libapr-1.lib libaprutil-1.lib libhttpd.lib  /LIBPATH:"{MySQL_root}\lib\opt" libmysql.lib

I wouldn't expect this mod_log_sql to work very well, but maybe you will get lucky!
Be sure to check that your Apache process doesn't use more memory as it runs (i.e. a memory leak because of the change to line 1397).

re: "gives an Application error alert box on every refresh"

A common error is to have the wrong version of libmysql.dll in your system32 directory.

You should try copying the correct libmysql.dll from your MySQL \bin directory to Apache's \bin directory.
mod_log_sql will then use this file instead of the one in system32.

-tom-
Back to top
someone



Joined: 06 Jul 2006
Posts: 11

PostPosted: Wed 18 Oct '06 19:50    Post subject: Reply with quote

Thanks tdonovan! Mod_log_mysql seems to work after I compiled these .so -files your way. Hope commenting that one line(1397) does not leak memory or something bad.

One more question: Why does not ssl https requests get logged on mod_log_mysql? How to enable it? Shocked

http://bitbrook.de/software/mod_log_mysql/
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Thu 19 Oct '06 2:15    Post subject: Reply with quote

re: "Why does not ssl https requests get logged"

There often is a separate CustomLog directive for SSL requests.
Look in conf\extra\httpd-ssl.conf if you have this file.
Replace this directive with a CustomLog directive identical to the one in your regular httpd.conf file.
SSL requests should then be logged to MySQL just like regular requests.

re: "Hope commenting that one line(1397) does not leak memory..."

I looked more carefully at the source code for mod_log_config.c.
I think a safer fix would be to leave line 1397 as it originally was, and add a new line just after all the #include directives near the top of the source file (around line 228):
Code:
#undef exit


This will undefine the APR macro named 'exit' which conflicts with the function pointer variable named 'exit' in mod_log_config.c.

Of course there still may be problems because mod_log_mysql is not intended for Apache 2.2 - but this will keep you from introducing any new problems.
It is still a good idea to test your new mod_log_mysql very carefully before you trust it.

I am dissappointed that mod_log_sql did not work for you.
mod_log_sql is more likely to be maintained for current and future versions of Apache so I think it is preferable to mod_log_mysql.
Can you give some more detail about your memory error?
    Did you build Apache 2.2.2 yourself using VS 2005? get it from Apache Lounge? or from www.apache.org?
    Which version of MySQL do you use?
    Did you get the memory error with a mod_log_sql that you built yourself, or did you get it with the binaries I pointed to?
    I'm not sure what you mean when you say "Even when I compiled different versions but always error - different versions of mod_log_sql?

-tom-
Back to top
someone



Joined: 06 Jul 2006
Posts: 11

PostPosted: Thu 19 Oct '06 14:02    Post subject: Reply with quote

Thanks for your quick reply! SSL is ok now, and "#undef exit" works too!!

Well I tested almost 'all' setups with mod_log_sql but couldn't get rid of the memory error pop-up. I've tried both of yours you pointed. Also compiled v1.1, 1.99 and some other versions using build-apache2.bat. Tested with Mysql beta 5.0.3(>copied libmysql.dll to system32 etc. dirs), then installed Mysql stable 5.026(>copied libmysql.dll,and some other files..) and compiled mod_log_sql few times. Still error. On some setups there was less errors, like every ~15th refresh made error, some pages maybe didn't at all.

Apache 2.2.2 may be from Apachelounge, don't remember. I've compiled some of the files myself, e.g. libhttpd, some modules, etc. Btw. There was a nice ad in Apachelounge's apache "Server API : Apache 2.0 Handler (www.apachelounge.com)" :d

But thanks again tdonovan! Mr. Green

Still one more q:
Code:
LogFormat "INSERT INTO accesslog SET virtualhost=%v,\
..
ssl_protocol=%{SSL_PROTOCOL}x,\
ssl_cipher=%{SSL_CIPHER}x" accesslog

No SSL protocol nor cipher gets logged? This is not necessary. But if you might know..
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Thu 19 Oct '06 17:05    Post subject: No SSL protocol nor cipher gets logged Reply with quote

re: "No SSL protocol nor cipher gets logged"

I just tried configuring them with Apache 2.2.3 on Windows 2000sp4.
I'm using MySQL 5.0.21 and mod_log_mysql built with Visual Studio 2005.
My config directives are:
Quote:
LogFormat "insert into access_log2 set host=%h,time=%t,method=%m,url=%R,status=%>s,prot=%{SSL_PROTOCOL}x,cipher=%{SSL_CIPHER}x" mysql
CustomLog mysql://{username}:{password}@{servername}/apachelogs mysql
My CustomLog directive is the same in both httpd.conf and in httpd-ssl.conf.

The fields prot and cipher get logged for me by mod_log_mysql.
These are the values I see for prot and cipher:

    any browser - http: - both fields contain a hyphen
    FireFox 1.5 - https: - "TLSv1" and "DHE-RSA-AES256-SHA"
    IE6.0 - https: - "SSLv3" and "RC4-MD5"


Maybe it is something peculiar to Apache 2.2.2?

-tom-
Back to top
someone



Joined: 06 Jul 2006
Posts: 11

PostPosted: Thu 19 Oct '06 20:10    Post subject: Reply with quote

Quote:
My CustomLog directive is the same in both httpd.conf and in httpd-ssl.conf.
Hah, ya it works after I put ssl cip and prot into both of them. Thx!

Btw. Could you(tdonovan) sometime take a look at "MOD_VHOST_DBI" -topic also, IF you might know something..

http://www.apachelounge.com/viewtopic.php?t=944
Back to top
someone



Joined: 06 Jul 2006
Posts: 11

PostPosted: Sun 22 Oct '06 19:51    Post subject: mod_vhost_dbi Reply with quote

When I execute command:
Code:
apxs -c -i mod_vhost_dbi.c

It gives one error:
Code:
mod_vhost_dbi.c(501) : error C2491: 'vhost_dbi_module' : definition of dllimport data not allowed
apxs:Error: Command failed with rc=131072

Lines 501-509 from mod_vhost_dbi.c:
Code:
AP_DECLARE_DATA module vhost_dbi_module = {
    STANDARD20_MODULE_STUFF,
    NULL,
    NULL,
    vhost_dbi_create_server_config,
    NULL,
    vhost_dbi_commands,
    register_hooks 
};

Do you know? Should not be that hard but how to fix this?

Sad
Back to top


Reply to topic   Topic: mod_log_mysql, mod_log_sql View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules