Created
May 1, 2017 22:55
-
-
Save DinoChiesa/285d206fd4129b60b959690907e760ca to your computer and use it in GitHub Desktop.
JS policy config for fire-and-forget logging to Splunk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Javascript name='JS-Log-To-Splunk' timeLimit='2200'> | |
<!-- | |
timeLimit = 2200 to allow for waiting for Splunk to respond. | |
This is necessary only during diagnostic efforts. | |
See the KVM entry "splunk_await_response". In normal | |
cases, the JS logic does not wait for a response. | |
--> | |
<Properties> | |
<Property name='authz_header'>Splunk {splunk_hec_token}</Property> | |
<!-- | |
"host" : "apigeeedgehost", | |
"sourcetype" : "something", | |
--> | |
<Property name='payload'>{ | |
"source" : "apigeeedge", | |
"event" : { | |
"apigeeedge.org" : "{organization.name}", | |
"apigeeedge.env" : "{environment.name}", | |
"request.path" : "{request.path}", | |
"apiproxy" : "{apiproxy.name}", | |
"apiproxy.revision" : {apiproxy.revision}, | |
"apiproxy.endpoint" : "{proxy.name}", | |
"messageid" : "{messageid}", | |
"apiproduct.name" : "{apiproduct.name}", | |
"developer.app.name" : "{developer.app.name}", | |
"developer.id" : "{developer.id}", | |
"developer.email" : "{developer.email}", | |
"client_id" : "{client_id}", | |
"request_length" : "{request.header.content-length}", | |
"response_length" : "{response.header.content-length}", | |
"target_elapsed" : "{time_target_elapsed}", | |
"total_elapsed" : "{time_total_elapsed}" | |
} | |
}</Property> | |
<Property name='endpoint'>{splunk_target}/services/collector/event</Property> | |
</Properties> | |
<ResourceURL>jsc://log-To-Splunk.js</ResourceURL> | |
</Javascript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment