Whoa, Splunk Ingest Processor is now Generally Available! If you haven’t already, you might be getting started with building your first pipelines Ingest Processor, or perhaps you’ve already been exploring Splunk Edge Processor. You’ve logged into the user interface and poked around — maybe you’ve even started sending in data over HEC, forwarders, or Syslog! But now you’re stuck. How do you write your first pipeline? Sure, you know SPL, but SPL2? In a streaming context? How do you even get started?
Introducing Splunk’s SPL to SPL2 converter, now available for Splunk Data Management‘s Edge Processor and Ingest Processor (herein known collectively as “pipeline builders!”) Simply copy and paste, or hand-type, SPL in your pipeline, and Splunk will convert it to SPL2. It’s a fantastic tool for getting up & running with your first few edge or ingest processor pipelines, allowing you to learn SPL2 along the way — you can even copy & paste existing SPL searches from Splunk Cloud Platform or Splunk Enterprise to turn search-time analytics into pre-ingest transformations! (So goes the proverb, "with great power comes great responsibility.")
Let’s learn more.
Converting SPL to SPL2 is simple. Let’s start with a basic, empty Edge Processor pipeline:
In honor of Splunk’s recent acquisition by Cisco, let’s say that this is Cisco ASA data, and we want to extract the message number field from _raw, filter out a specific message number, and set the vendor name as “Cisco”. Well, how would you write that search in SPL? We already know how to do that!
| rex field=_raw "/(%ASA|%FTD)-\d+-(?P\d+)/" | search message-number != 43003 | eval vendor_name = "Cisco" | fields - message-number
Now, how do you use this SPL in an Edge Processor pipeline? You have two ways:
All you have to do now is write your SPL query in the spl1 command, or use backticks. If your query can convert to SPL2, clicking on your query should result in a lightbulb appearing on the left side. Alternatively, you can hover over the query and click “Quick Fix”. Click on “Convert SPL1 to SPL2” and voila!
You’ll notice that one of the minor differences in SPL and SPL2, the fact that field names with non-alphanumeric characters (or the underscore _ character) must be ‘single-quoted’, is automatically addressed - the converter added single quotes around message-number.
But wait, what about the search command? According to the command support matrix, Edge Processor doesn’t (yet) support it. No worries - the converter will also try to convert search clauses as well, to become the where command (with exceptions):
When converting from SPL to SPL2, keep a few things in mind.
$pipeline = from $source | <SPL here> | <SPL2 here> | <SPL here> | into $destination
Because SPL’s search and SPL2’s where are not always semantically identical, and for best practices overall, it’s highly recommended that you test the pipeline first before deciding that the converted SPL2 reflects the original intent of the SPL.
Go on, nothing’s stopping you from trying it out yourself — start up your backticks & let’s get ready to rumble!
For a full explanation of the SPL to SPL2 converter’s capabilities and limitations, visit our documentation.
Want to see more kinds of supported SPL to SPL2 conversions? File an idea for Edge Processor on the Splunk Ideas portal!
Want to chat about SPL to SPL2 conversions in general? Find us in the #spl2 channel in the Splunk user-groups Slack!
The Splunk platform removes the barriers between data and action, empowering observability, IT and security teams to ensure their organizations are secure, resilient and innovative.
Founded in 2003, Splunk is a global company — with over 7,500 employees, Splunkers have received over 1,020 patents to date and availability in 21 regions around the world — and offers an open, extensible data platform that supports shared data across any environment so that all teams in an organization can get end-to-end visibility, with context, for every interaction and business process. Build a strong data foundation with Splunk.