cancel
Showing results for 
Search instead for 
Did you mean: 
bdoyle
Level 7

Web Gateway custon logging

Jump to solution

Hi All,

We have a MWG applicance running 7.2 which has been set up as an ICAP server. The ICAP traffice is sent from the clitne using a Java application. As part of the application, a custom header is sent with the ICAP traffic from the client. We want this header to be added to the Access.log file. Does anyone know of any way to do this?

Thanks,

Brian


0 Kudos
1 Solution

Accepted Solutions
eelsasser
Level 15

Re: Web Gateway custon logging

Jump to solution

Hi Brian,

Yes, you can do it.

Let's say your request has a custom header like X-MyCustom-Header:

RESPMOD icap://192.168.2.231:1344/RESPMOD ICAP/1.0
Host: 192.168.2.231:1344
X-Client-IP: 192.168.2.100
X-MyCustom-Header: ThisIsATest
Encapsulated: req-hdr=0, res-hdr=90, res-body=109

GET http://192.168.2.100/634769037391920771/Filename.TXT HTTP/1.1
Host: 192.168.2.100

HTTP/1.1 200 OK

You can access and/or log the value of this header using the property:

Header.ICAP.Request.Get ("X-MyCustom-Header")

You can use it directly like that in a log field or you can test the value in the rules and perform an action:

Rule Criteria:
Header.ICAP.Request.Get ("X-MyCustom-Header") equals "ThisIsATest"

Action: Block

Does that help?

0 Kudos
3 Replies
eelsasser
Level 15

Re: Web Gateway custon logging

Jump to solution

Hi Brian,

Yes, you can do it.

Let's say your request has a custom header like X-MyCustom-Header:

RESPMOD icap://192.168.2.231:1344/RESPMOD ICAP/1.0
Host: 192.168.2.231:1344
X-Client-IP: 192.168.2.100
X-MyCustom-Header: ThisIsATest
Encapsulated: req-hdr=0, res-hdr=90, res-body=109

GET http://192.168.2.100/634769037391920771/Filename.TXT HTTP/1.1
Host: 192.168.2.100

HTTP/1.1 200 OK

You can access and/or log the value of this header using the property:

Header.ICAP.Request.Get ("X-MyCustom-Header")

You can use it directly like that in a log field or you can test the value in the rules and perform an action:

Rule Criteria:
Header.ICAP.Request.Get ("X-MyCustom-Header") equals "ThisIsATest"

Action: Block

Does that help?

0 Kudos
bdoyle
Level 7

Re: Web Gateway custon logging

Jump to solution

Yes, that's now sending the custom header to the log file as we required - thanks! Also, is it possible to add a header to the log file for this (where the other headers are #time_stamp "auth_user" src_ip status_code "req_line" etc)

-Brian

0 Kudos
eelsasser
Level 15

Re: Web Gateway custon logging

Jump to solution

Yep. In the File System logging settings:

Capture.jpg

0 Kudos