SplConverter 0.1.0-alpha.1

This is a prerelease version of SplConverter.
dotnet add package SplConverter --version 0.1.0-alpha.1
                    
NuGet\Install-Package SplConverter -Version 0.1.0-alpha.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SplConverter" Version="0.1.0-alpha.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SplConverter" Version="0.1.0-alpha.1" />
                    
Directory.Packages.props
<PackageReference Include="SplConverter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SplConverter --version 0.1.0-alpha.1
                    
#r "nuget: SplConverter, 0.1.0-alpha.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SplConverter@0.1.0-alpha.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SplConverter&version=0.1.0-alpha.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SplConverter&version=0.1.0-alpha.1&prerelease
                    
Install as a Cake Tool

SplConverter

A lightweight .NET library for converting Splunk SPL queries into:

  • Elasticsearch Query DSL
  • Elasticsearch ES|QL

Author

Farshid Sar

NuGet.org: https://www.nuget.org/profiles/farshidsar

Status

Preview release.

This package currently supports a practical subset of SPL and is under active development.


Features

Supported Commands

Search / Where

status=500
host="web01"
status=500 AND host="web01"
NOT status=200

Time Range

earliest=-24h latest=now

Statistics

| stats count
| stats count by host
| stats avg(duration) by service

Timechart

| timechart count

Eval

| eval severity="error"

Rex

| rex field=message "(?<user>\w+)"

Sort

| sort -timestamp

Head / Tail

| head 10
| tail 10

Top / Rare

| top host
| rare host

Dedup

| dedup host

Table / Fields

| table host status
| fields host status

Rename

| rename host as hostname

Installation

Local Package

dotnet add package SplConverter

Local Feed

Create a local feed folder and pack:

dotnet pack -c Debug -o ./artifacts

Then add the folder as a NuGet source.


Quick Start

using Spl.Core;
using Spl.Core.Options;

var converter = new SplConverter();

var result = converter.ToElasticDsl(
    "status=500 | stats count by host",
    new SplConverterOptions
    {
        IndexName = "logs-*",
        TimeField = "@timestamp"
    });

Console.WriteLine(result.Output);

ES|QL Example

Input:

status=500 | stats count by host

Output:

FROM logs-*
| WHERE status == 500
| STATS count(*) BY host

Elasticsearch DSL Example

Input:

status=500 | stats count by host

Output:

{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "status": 500
          }
        }
      ]
    }
  }
}

Configuration

var options = new SplConverterOptions
{
    IndexName = "logs-*",
    TimeField = "@timestamp",
    KeywordSuffix = ".keyword",
    IndentJson = true
};

CLI Usage

spl-converter --spl "status=500 | stats count by host" --target dsl
spl-converter --spl "status=500 | stats count by host" --target esql
spl-converter --input query.spl --target dsl
cat query.spl | spl-converter --target esql

Building

dotnet restore
dotnet build

Create package:

dotnet pack Spl.Core/Spl.Core.csproj -c Debug -o ./artifacts

Debugging From Another Project

During active development, prefer:

<ProjectReference Include="..\Spl.Core\Spl.Core.csproj" />

instead of a NuGet package.

Advantages:

  • Step into source code
  • Hot rebuilds
  • Easier debugging
  • No package republishing

When the library becomes stable, switch back to:

<PackageReference Include="SplConverter" Version="0.1.0-preview.1" />

Roadmap

  • Better SPL parser coverage
  • More aggregation functions
  • Improved ES|QL generation
  • Better diagnostics
  • Full parser test suite
  • SourceLink support
  • CI/CD pipeline

Maintainer

Maintained by Farshid Sar.

NuGet Profile: https://www.nuget.org/profiles/farshidsar

Feedback and feature requests are welcome.


License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.1 76 6/8/2026