how to retrieve all variables from ServiceCallOut policy to make logging into splunk.

Hi, all

I need your advise or suggestion.

we are trying to make logging information after ServiceCallOut policy was invoked.

we created a JavaScript policy to retrieve the attributes of serviceCallout as below.

* request time stamp(start/end)

* response time stamp (start/end)

* request headers , request query parameters, request payload

* response headers, response content.

but in content for serviceCallout has limited variables that I can access as below:

http://docs.apigee.com/api-services/reference/service-callout-policy

servicecallout.{policy-name}.failed

servicecallout.{policy-name}.expectedcn

servicecallout.{policy-name}.target.url

servicecallout.requesturi

question is

1) is there a way to get dynamically to get {policy-name} of serviceCallout ? otherwise, I have to do hardcode of policy-name of servicecallout.

2) is there any policy to retrieve serviceCallOut information for logging purpose ?

any advise will be appreciated.

0 1 382
1 REPLY 1

Hi @Sungho.Maeung2,

You can retrieve the values above from these variables assigned under request or response variables from Service Callout policy

target.received.end.time
target.received.end.timestamp
target.received.start.time
target.received.start.timestamp
request.content
request.header.{header_name}
request.formparam.{formparam_name}
request.queryparam.{queryparam_name}
repsonse.content
response.header.{header_name}

Refer to Variables documentation for available flow variables