Contribute Open Script

[BRCD_OS_114] Log Request details on Syslog

by Yasir_Liaqatullah on ‎01-20-2012 02:40 PM (398 Views)

Area

Logging

Traffic

HTTP

Description

            This script analyzes the incoming request and sends the request headers as log message to a syslog server. (Only one OS_SLB::log API can be used in an event)

Performance Estimate

           

            Contact us for our detailed reporting

               or

            Report your own performance estimate

Required Backend configuration

            Below is the additional configuration on ADX to reach syslog server

  print-output syslog                                          

!

logging 10.24.129.8                                           

logging on

Events and API Used

Events

API

HTTP_REQUEST

OS_HTTP_REQUEST::headers_as_string

OS_SLB::forward

Script source code

#Purpose: Log request header to SYSLOG server

#

########################################################

# For this to work ADX should be configured with..

# 1. scritp profile with print pointed to syslog

# 2. logging enabled on ADX

# 3. Have an interface pointed to Syslog server

#

########################################################

# Below is the additional config on ADX

# !

# # print-output syslog                                          

# !

# logging 10.24.129.8                                           

# logging on

# !

########################################################

use OS_SLB;

use OS_HTTP_REQUEST;

sub HTTP_REQUEST () {

   #print "HTTP Request event is triggered\n";

   my $headers_received = OS_HTTP_REQUEST::headers_as_string;

   #print "Headers in received HTTP Request - $headers_received\n";

   # Log headers to Syslog

   OS_SLB::log("$headers_received");

   OS_SLB::forward("30");

}