When Splunk is deployed to Amazon Web Services (AWS), Splunk can be configured to archive data to Amazon’s S3 storage using Hadoop to broker the data transfer and Splunk search queries. The archival storage is in addition to the standard Amazon Elastic Block Store used for Splunk’s hot, warm, and cold buckets. Using S3 storage is typically cheaper than using Elastic Block Store because of its slower performance. This cheaper, but slower, storage is perfect for archiving data that is infrequently needed, but is still searchable by Splunk.
The AWS environment used to setup an example of a Splunk archive to S3 was:
- AWS Virtual Private Cloud (VPC) containing 3 availability zones (AZ)
- AWS S3 bucket in AWS region US-EAST-1
- Splunk indexer cluster with one indexer in each AZ
- Splunk Virtual Machines (VM) created using AWS Linux with pre-installed Splunk from the AWS Marketplace
- Splunk version 6.6.2
- Apache Hadoop version 2.7.4
- OpenJDK Java 8
- Must install openssl-devel.x86_64 package on all Splunk indexers
Splunk AWS S3 Configuration
The benefit of using AWS Linux is that it comes with the AWS command line interface already installed. On each of the AWS VMs hosting a Splunk indexer, make sure that the AWS command line interface is configured to connect to the target S3 bucket.
At the shell prompt:
- Become the Splunk user (typically “splunk”)
- Enter: aws configure
- At the resulting prompt, enter the AWS access key to the target S3 bucket
- Enter the AWS secret key
- Accept the defaults presented for the remaining settings
- Test the configuration by entering: aws s3 ls <bucket_name>
It’s helpful to have a test document in the S3 bucket so the test listing produces a result. This document can be removed when you’re done testing the connections from each indexer.
Hadoop Installation and Configuration
1. Hadoop installed in /opt (Splunk installs in /opt by default)
2. Hadoop owner and group must be the same as for Splunk (often this is splunk:splunk)
3. Created Hadoop working directory: /opt/hadoop/working_dir
4. Added the following to the Splunk user .bashrc
5. Configuration added to: /opt/hadoop/etc/hadoop/core-site.xml
6. Configuration added to: /opt/hadoop/etc/hadoop/hadoop-env.sh
7. Test the Hadoop connection to the S3 bucket as the Splunk user on each indexer at the shell prompt:
Splunk AWS S3 Provider Configuration
For non-clustered environments, the Splunk web interface allows configuration of the S3 provider at: Settings > Virtual indexes. However, with an indexer cluster, you need to edit the indexes.conf file and deploy it to the indexers.
The Splunk AWS S3 provider was configured in indexes.conf as follows:
Splunk Archive Index Configuration
Each index to be archived needs a corresponding archive index that is the name of the index with a suffix of “_archive”. Three archive indexes were created in this demo environment to show that multiple indexes could be archived to the same S3 bucket. These configurations need to be deployed to both the indexers and the search heads.
The Splunk archive indexes were configured in indexes.conf as follows:
There will be some overlap between the data in the normal Splunk indexes and the archive indexes in the S3 bucket that is determined by the settings above. To learn more about how to properly adjust the overlap, see the Splunk document:
The “older.than” and “search.cutoff_sec” values above are in seconds and were made very small so the demo environment would move data to the S3 bucket quickly. Obviously, the values would be much larger in a production environment.
Splunk Unified Search Configuration
Splunk’s unified search capability allows you to search both the normal index and its archive by only specifying the normal index name. Splunk will know, based on the time span chosen, when to look in the archive index for data. Some of the configurations needed were added to the archive indexes in the previous section. The remaining configurations for unified search are added to limits.conf on both indexers and search heads as follows:
Using Splunk Unified Search
Once data has rolled through hot, warm, and cold buckets it will then get copied out to the archive index associated with the normal index. This data can be viewed in the web browser by navigating in AWS to the target S3 bucket. In this demo environment, one could use “index=main” as the search query and get data back from both the “main” and “main_archive” indexes depending on the time period selected.
Assistance with Archiving Splunk Data
For assistance with archiving Splunk data, or help with anything Splunk, contact Aditum’s Splunk Professional Services consultants. Our certified Splunk Architects and Splunk Consultants manage successful Splunk deployments, environment upgrades and scaling, dashboard, search, and report creation, and Splunk Health Checks. Aditum also has a team of accomplished Splunk Developers that focus on building Splunk apps and technical add-ons.
- Splunk Common Information Model – Your Questions Answered - August 10, 2018
- Splunk Archive to AWS S3: How to Add Amazon S3 Storage to Your Splunk Environment - February 6, 2018