Skip to content

Commit 2ec9a89

Browse files
sharangokul28Shiva Sharan Yadav GOKUL
authored andcommitted
[FEATURE] Splunk: new plugin for perses
Signed-off-by: Sharan Gokul <sharangokul@gmail.com>
1 parent f50d307 commit 2ec9a89

45 files changed

Lines changed: 6293 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

splunk/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Splunk Plugin for Perses
2+
3+
## Overview
4+
5+
The Splunk plugin enables Perses to connect to Splunk instances and query data using Splunk Processing Language (SPL). It supports both time series visualizations and log queries.
6+
7+
## Features
8+
9+
- **Splunk Datasource**: Connect to Splunk Enterprise or Splunk Cloud instances
10+
- **Time Series Queries**: Execute SPL queries for time series data visualization
11+
- **Log Queries**: Retrieve and display log data from Splunk
12+
- **Variable Support**: Use Perses variables in your SPL queries
13+
- **Flexible Authentication**: Support for direct URL or proxy-based connections
14+
15+
## SPL Query Examples
16+
17+
### Time Series Examples
18+
19+
```spl
20+
# Count events over time
21+
search index=main | timechart count
22+
23+
# Average response time by service
24+
search index=web | timechart avg(response_time) by service
25+
26+
# Error rate over time
27+
search index=main error | timechart count
28+
```
29+
30+
### Log Query Examples
31+
32+
```spl
33+
# Recent errors
34+
search index=main error | head 100
35+
36+
# Specific application logs
37+
search index=app sourcetype=application:log level=ERROR
38+
39+
# Search with filters
40+
search index=main host=server01 status=500
41+
```
42+
43+
## API Endpoints
44+
45+
The plugin uses the following Splunk REST API endpoints:
46+
47+
- `/services/search/jobs` - Create search jobs
48+
- `/services/search/jobs/{sid}` - Get job status
49+
- `/services/search/jobs/{sid}/results` - Get search results
50+
- `/services/search/jobs/{sid}/events` - Get search events
51+
- `/services/search/jobs/export` - Export search results
52+
- `/services/data/indexes` - Get index information
53+
54+
## Authentication
55+
56+
Splunk authentication can be configured through:
57+
58+
- HTTP headers (Authorization token)
59+
- Proxy settings with credentials
60+
- Direct URL with embedded credentials (not recommended for production)

splunk/cue.mod/module.cue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module: "github.com/perses/plugins/splunk@v0"
2+
language: {
3+
version: "v0.15.1"
4+
}
5+
source: {
6+
kind: "git"
7+
}
8+
deps: {
9+
"github.com/perses/shared/cue@v0": {
10+
v: "v0.53.0-rc.1"
11+
default: true
12+
}
13+
}

splunk/go.mod

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module github.com/perses/plugins/splunk
2+
3+
go 1.25.1
4+
5+
require github.com/perses/perses v0.53.0-rc.0
6+
7+
require (
8+
github.com/beorn7/perks v1.0.1 // indirect
9+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
10+
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
11+
github.com/jpillora/backoff v1.0.0 // indirect
12+
github.com/kr/text v0.2.0 // indirect
13+
github.com/muhlemmer/gu v0.3.1 // indirect
14+
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
15+
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
16+
github.com/prometheus/client_golang v1.23.2 // indirect
17+
github.com/prometheus/client_model v0.6.2 // indirect
18+
github.com/prometheus/common v0.67.2 // indirect
19+
github.com/prometheus/procfs v0.17.0 // indirect
20+
github.com/zitadel/oidc/v3 v3.45.0 // indirect
21+
github.com/zitadel/schema v1.3.1 // indirect
22+
go.yaml.in/yaml/v2 v2.4.3 // indirect
23+
golang.org/x/net v0.46.0 // indirect
24+
golang.org/x/oauth2 v0.33.0 // indirect
25+
golang.org/x/sys v0.37.0 // indirect
26+
golang.org/x/text v0.30.0 // indirect
27+
google.golang.org/protobuf v1.36.10 // indirect
28+
gopkg.in/yaml.v3 v3.0.1 // indirect
29+
)

splunk/jest.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright The Perses Authors
2+
// Licensed under the Apache License, Version 2.0 (the \"License\");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an \"AS IS\" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
import type { Config } from '@jest/types';
15+
import shared from '../jest.shared';
16+
17+
const jestConfig: Config.InitialOptions = {
18+
...shared,
19+
20+
setupFilesAfterEnv: [...(shared.setupFilesAfterEnv ?? []), '<rootDir>/src/setup-tests.ts'],
21+
};
22+
23+
export default jestConfig;

0 commit comments

Comments
 (0)