You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
877 B
38 lines
877 B
9 months ago
|
#!/bin/bash
|
||
|
|
||
|
# Prompt for the app name
|
||
|
read -p "Enter the name of your Splunk app: " APP_NAME
|
||
|
|
||
|
# Prompt for the app description
|
||
|
read -p "Enter a description for your Splunk app: " APP_DESCRIPTION
|
||
|
|
||
|
# Define the base directory for the app, adjust it if you have a different Splunk apps directory
|
||
|
SPLUNK_APPS_DIR="/opt/splunk/etc/apps"
|
||
|
|
||
|
# Construct the app directory path
|
||
|
APP_DIR="$SPLUNK_APPS_DIR/$APP_NAME"
|
||
|
|
||
|
# Create the directory structure
|
||
|
mkdir -p "$APP_DIR/bin"
|
||
|
mkdir -p "$APP_DIR/default"
|
||
|
mkdir -p "$APP_DIR/local"
|
||
|
mkdir -p "$APP_DIR/metadata"
|
||
|
mkdir -p "$APP_DIR/static"
|
||
|
mkdir -p "$APP_DIR/lookups"
|
||
|
|
||
|
# Create a basic app.conf file
|
||
|
cat <<EOT > "$APP_DIR/default/app.conf"
|
||
|
[launcher]
|
||
|
version = 1.0
|
||
|
description = $APP_DESCRIPTION
|
||
|
|
||
|
[ui]
|
||
|
is_visible = 1
|
||
|
label = $APP_NAME
|
||
|
|
||
|
[install]
|
||
|
is_configured = false
|
||
|
EOT
|
||
|
|
||
|
echo "Splunk app $APP_NAME has been created successfully in $APP_DIR"
|