Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: Is it possible to createa module that log RAW HTTP requests? |
|
Author |
|
Tigrou
Joined: 25 Dec 2023 Posts: 1 Location: Belgium
|
Posted: Tue 26 Dec '23 14:38 Post subject: Is it possible to createa module that log RAW HTTP requests? |
|
|
Hello,
I would like to create a module that logs HTTP requests in their raw format (as they are send to Apache, at byte level).
Here is one example:
Code: | TimeStamp
Request headers
\r\n
Request body size
Request body (optional)
\r\n
Response headers
\r\n
Response body size
Response body (optional) |
Code: | 1703593572
GET /foo/bar HTTP/1.1
Host: example.org
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Accept: */*
0
HTTP/1.1 200 OK
Date: Sun, 10 Oct 2010 23:26:07 GMT
Connection: close
Content-Type: text/html
1472
<html>
<body>
...
|
I already took a look at some existing modules like mod_log_forensic, mod_dumpio but what they dump is imcomplete (eg: it's only header or body) and not in the format I want.
I already know C/C++, but I am unfamiliar with Apache code. Before coding anything I would like to know if this is easily feasible.
I plan to start using mod_dumpio as example.
https://github.com/omnigroup/Apache/blob/master/httpd/modules/debugging/mod_dumpio.c
My main concern I have :
- It seems filters callback are called multiple times for the same request. I want to log the request/response as a single blob. How to achieve this, is there something similar to a transaction (eg: it's possible to know when request starts and when it ends)
- mod_log_forensic dump the headers by looping on the headers data structure already parsed by Apache. Is it possible to instead dump the bytes data ?
The Apache version I use is 2.4.58 with Cent OS (Linux) |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
|
|
|
|
|