Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit34bda19

Browse files
committed
Add request header hostname to log
1 parent9c0229c commit34bda19

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎apache2/apache2_util.c‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ static void internal_log_ex(request_rec *r, directory_config *dcfg, modsec_rec *
254254
if (level <=3) {
255255
char*unique_id= (char*)get_env_var(r,"UNIQUE_ID");
256256
char*hostname= (char*)msr->hostname;
257+
char*requestheaderhostname= (char*)r->hostname;
257258

258259
if (unique_id!=NULL) {
259260
unique_id=apr_psprintf(msr->mp," [unique_id \"%s\"]",
@@ -267,14 +268,20 @@ static void internal_log_ex(request_rec *r, directory_config *dcfg, modsec_rec *
267268
}
268269
elsehostname="";
269270

271+
if (requestheaderhostname!=NULL) {
272+
requestheaderhostname=apr_psprintf(msr->mp," [requestheaderhostname \"%s\"]",
273+
log_escape(msr->mp,requestheaderhostname));
274+
}
275+
elserequestheaderhostname="";
276+
270277
#ifAP_SERVER_MAJORVERSION_NUMBER>1&&AP_SERVER_MINORVERSION_NUMBER>2
271278
ap_log_rerror(APLOG_MARK,APLOG_ERR |APLOG_NOERRNO,0,r,
272-
"[client %s] ModSecurity: %s%s [uri \"%s\"]%s",r->useragent_ip ?r->useragent_ip :r->connection->client_ip,str1,
273-
hostname,log_escape(msr->mp,r->uri),unique_id);
279+
"[client %s] ModSecurity: %s%s [uri \"%s\"]%s%s",r->useragent_ip ?r->useragent_ip :r->connection->client_ip,str1,
280+
hostname,log_escape(msr->mp,r->uri),unique_id,requestheaderhostname);
274281
#else
275282
ap_log_error(APLOG_MARK,APLOG_ERR |APLOG_NOERRNO,0,r->server,
276-
"[client %s] ModSecurity: %s%s [uri \"%s\"]%s",msr->remote_addr ?msr->remote_addr :r->connection->remote_ip,str1,
277-
hostname,log_escape(msr->mp,r->uri),unique_id);
283+
"[client %s] ModSecurity: %s%s [uri \"%s\"]%s%s",msr->remote_addr ?msr->remote_addr :r->connection->remote_ip,str1,
284+
hostname,log_escape(msr->mp,r->uri),unique_id,requestheaderhostname);
278285
#endif
279286

280287
/* Add this message to the list. */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp