How to Connect to Splunk Through Anypoint Studio in 10 Steps
A quick, step-by-step tutorial on how to create a Splunk account and connect it to Anypoint Studio using the cloud platform provided by Splunk.
Join the DZone community and get the full member experience.Join For Free
1. Create a Splunk Account using the below link:
We can use either the cloud option or the download option.
In this blog, we will be using the cloud option. An email will be triggered for verification and once verification is complete we will get our Splunk credentials like below:
Note: Save the Cloud-URL. We will be using this in the following steps.
2. Log in to the URL received via email:
Navigate to Settings -> Data Input
3. Open the HTTP Event Collector and click 'New Token':
4. Add the below config in the new token Config. Once we submit, we will get the token. Save the Token. We will be using this token in the next steps:
5. Create one sample project.
Here we are using an HTTP Listener and create a sample payload. The same payload is being logged using the JSON logger.
6. Update the POM to include the below dependency and repository:
7. Copy the below Log4j file and replace the existing Log4j under src/main/resources.
Note: This is a minimum Log4j configuration to send the data to Splunk. Update the Your-CloudURL and Your-Token which you received in the previous steps.
8. Run the application and hit the below local URL:
9. Open the Search Reporting section in Splunk using the same cloud URL:
10. We can search the logs using the message part which we sent using the JSON logger:
Opinions expressed by DZone contributors are their own.