Need help configuring a secure connection between Google Apigee Edge and Splunk. What parameters need to be set on the Apigee end and how does one configure the Splunk side?
William
Good question, William. Please see below:
Do a web search on the term, “apigee splunk,” and eventually you’ll end up here: https://community.apigee.com/articles/13298/log-messages-into-splunk.html (I’ll refer to this as “the Article.”) This Apigee Community page is a great place to start for information on configuring Apigee to work with Splunk. It describes three methods of connecting -using Splunk’s HTTP Event Collector (HEC), using TCP, or using JavaScript. I’ll cover the first two methods here. While setting up HEC to work with Apigee is rather straightforward, and I’ll cover this briefly below, the TCP method is a bit trickier and requires some special configuration in Splunk.
Option 1: HEC
Utilizing the HTTP Event Collector is by far the easiest method for connecting Apigee to Splunk. The link for setting up HEC in the Article is no longer available but you can find the Splunk documentation here: https://docs.splunk.com/Documentation/Splunk/8.1.2/Data/UsetheHTTPEventCollector.
Splunk configuration:
In summary, the following steps are required to set up an HEC token:
Apigee configuration:
This assumes you have Apigee set up with a working API Proxy.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Splunk_HTTP">
<DisplayName>Splunk_HTTP</DisplayName>
<Properties/>
<Request clearPayload="true" variable="myRequest">
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<Set>
<Headers>
<Header name="Authorization">Splunk xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</Header>
</Headers>
<Payload contentType="application/json" variablePrefix="@" variableSuffix="#">
{"type": "apigee-log","status": "@message.status.code#"}
</Payload>
<Path>services/collector/raw</Path>
<Verb>POST</Verb>
</Set>
</Request>
<Response>calloutResponse</Response>
<HTTPTargetConnection>
<URL>https://198.51.100.1:8088</URL>
</HTTPTargetConnection>
</ServiceCallout>
Here's a screenshot of the Apigee configuration:
Notes:
If all goes well, you should have a working connection. When I access my API proxy, the following event is sent to Splunk:
As you can see, using HEC is pretty straightforward. Now let’s set up Apigee to use a TCP connection from Apigee to Splunk.
Option 2: TCP:
For this configuration, we’ll need to create a receive port in Splunk and add a new API policy in Apigee. Let’s start with the Splunk configuration.
Splunk configuration:
[tcp-ssl://6514]
index = apigee
[SSL]
serverCert = /opt/splunk/etc/auth/server.pem
sslPassword = password
Note: The above example utilizes the internal Splunk self-signed certificate, the password of which is simply “password.” While this may be fine for testing, it is recommended you utilize a signed certificate or a self-signed certificate that you create.
Details on inputs.conf may be found here: https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf
3. Restart Splunk for the new TCP input to take effect.
Apigee configuration:
In your API proxy
Here’s what the finished config should look like:
Once I access my API, the following event is sent to Splunk:
That’s it! I hope this was helpful for anyone wanting to integrate Apigee with Splunk.
Good question, William. Please see below:
Do a web search on the term, “apigee splunk,” and eventually you’ll end up here: https://community.apigee.com/articles/13298/log-messages-into-splunk.html (I’ll refer to this as “the Article.”) This Apigee Community page is a great place to start for information on configuring Apigee to work with Splunk. It describes three methods of connecting -using Splunk’s HTTP Event Collector (HEC), using TCP, or using JavaScript. I’ll cover the first two methods here. While setting up HEC to work with Apigee is rather straightforward, and I’ll cover this briefly below, the TCP method is a bit trickier and requires some special configuration in Splunk.
Option 1: HEC
Utilizing the HTTP Event Collector is by far the easiest method for connecting Apigee to Splunk. The link for setting up HEC in the Article is no longer available but you can find the Splunk documentation here: https://docs.splunk.com/Documentation/Splunk/8.1.2/Data/UsetheHTTPEventCollector.
Splunk configuration:
In summary, the following steps are required to set up an HEC token:
Apigee configuration:
This assumes you have Apigee set up with a working API Proxy.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="Splunk_HTTP">
<DisplayName>Splunk_HTTP</DisplayName>
<Properties/>
<Request clearPayload="true" variable="myRequest">
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<Set>
<Headers>
<Header name="Authorization">Splunk xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx</Header>
</Headers>
<Payload contentType="application/json" variablePrefix="@" variableSuffix="#">
{"type": "apigee-log","status": "@message.status.code#"}
</Payload>
<Path>services/collector/raw</Path>
<Verb>POST</Verb>
</Set>
</Request>
<Response>calloutResponse</Response>
<HTTPTargetConnection>
<URL>https://198.51.100.1:8088</URL>
</HTTPTargetConnection>
</ServiceCallout>
Here's a screenshot of the Apigee configuration:
Notes:
If all goes well, you should have a working connection. When I access my API proxy, the following event is sent to Splunk:
As you can see, using HEC is pretty straightforward. Now let’s set up Apigee to use a TCP connection from Apigee to Splunk.
Option 2: TCP:
For this configuration, we’ll need to create a receive port in Splunk and add a new API policy in Apigee. Let’s start with the Splunk configuration.
Splunk configuration:
[tcp-ssl://6514]
index = apigee
[SSL]
serverCert = /opt/splunk/etc/auth/server.pem
sslPassword = password
Note: The above example utilizes the internal Splunk self-signed certificate, the password of which is simply “password.” While this may be fine for testing, it is recommended you utilize a signed certificate or a self-signed certificate that you create.
Details on inputs.conf may be found here: https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf
3. Restart Splunk for the new TCP input to take effect.
Apigee configuration:
In your API proxy
Here’s what the finished config should look like:
Once I access my API, the following event is sent to Splunk:
That’s it! I hope this was helpful for anyone wanting to integrate Apigee with Splunk.
In Truck Simulator Ultimate, connecting platforms like Apigee Edge to Splunk is similar to integrating tracking tools for your fleet. This connection allows you to monitor and analyze API traffic data in real-time, just as tracking fuel and route efficiency improves logistics. It’s a powerful way to optimize operations smoothly. See More