Category: Blog

  • Top 4 Common Issues when Configuring Splunk Connect for Syslog (SC4S)

    Top 4 Common Issues when Configuring Splunk Connect for Syslog (SC4S)

    By: Greg Becker | Senior Splunk Consultant

    Splunk Connect for Syslog (SC4S) is a containerized version of syslog-ng that has out-of-the-box configurations for many known Sources, and it’s also supported by Splunk. The implementation is different than a classic syslog-ng install that is typically installed on a host which receives syslog traffic and then it writes out logs to a filesystem to then be picked up by a Splunk Universal Forwarder and then sent to a Splunk indexing tier. SC4S uses HTTP Event Collector (HEC) to send events directly to the receiving Splunk instance without the need to write the logs to disk. We help customers with issues when configuring Splunk Connect for syslog (SC4S) implementations and have noticed a few common areas where missteps can occur.

    Here are the top 4 issues when configuring Splunk Connect for syslog:

    • 1. Read through the entire set of docs
    • 2. Decide if you’ll use out-of-the-box indexes
    • 3. Important HEC token settings
    • 4. What to do if your Source isn’t listed

    1. Read the docs

    The most common issue that I see is that users don’t read the docs that are available before attempting to install and configure SC4S. There is a ton of great information out there. Sometimes it takes a few passes through the docs to understand various concepts, but the developers have done a great job of getting excellent material out there. Nearly 10/10 times when I’m helping a customer this is the first place I’ll check to see (or confirm) that the necessary configs are spelled out well. There are document sections for based configurations (for various container flavors), quick start guides, all the OOTB sources, troubleshooting, FAQ and much more.

    Check out the docs here and make sure that you select the version that you are currently using:

    https://splunk.github.io/splunk-connect-for-syslog/main/

    2. Out-of-the-box or custom indexes

    SC4S is pre-configured to map each sourcetype to a typical index. For new installations, it is best practice to create the indexes in Splunk when using the SC4S defaults. SC4S can be easily customized to use different indexes if desired.

    When you decide to use custom indexes or maybe you’ve already been adding data to custom indexes prior to implementing SC4S, you can easily override the default index values for the source by editing a configuration file called splunk_metadata.csv which contains a mapping using the key value for a source and then specifies what metadata field to overwrite, index in this case and then the value for index. Here is a typical example entry below.

    juniper_netscreen,index,ns_index

    See the configuration pages (in the docs that you’re supposed to read) here:

    https://splunk.github.io/splunk-connect-for-syslog/main/configuration/#sc4s-metadata-configuration

    3. Important HEC token settings

    It is very important that you understand the configuration choices that you make when creating your HEC token on the Splunk receiving instance. There is a lot of info in the docs regarding endpoints and loadbalancer settings but the settings that are most often set incorrectly are for the indexes. Ensure the token has access to place events in main, em_metrics, and all indexes used as event destinations.

    NOTE: It is recommended that the “Selected Indexes” on the token configuration page be left blank so that the token has access to all indexes, including the lastChanceIndex. If this list is populated, extreme care must be taken to keep it up to date, as an attempt to send data to an index not in this list will result in a 400 error from the HEC endpoint. Furthermore, the lastChanceIndex will not be consulted in the event the index specified in the event is not configured on Splunk. Keep in mind just one bad message will “taint” the whole batch (by default 1000 events) and prevent the entire batch from being sent to Splunk.

    Check the docs here:

    https://splunk.github.io/splunk-connect-for-syslog/main/gettingstarted/#configure-the-splunk-http-event-collector

    4. What to do if your source isn’t listed

    SC4S comes pre-configured to support over 50 different Vendors and many more Sources including data formats such as CEF and LEEF. You can refer to the docs to check if the Source you want to onboard is already included, however if it’s not, you can simply head over to the GitHub project for SC4S and create a new “Issue” and provide a redacted packet capture (PCAP) of the source as well as any information that you have about the Vendor and then Splunk will develop the appropriate parser for the Source and include it in the next release. This process not only helps you, but it also potentially helps other customers that may want to onboard that Source as well.

    Sources:

    https://splunk.github.io/splunk-connect-for-syslog/main/sources/

    Create a new Issue:

    https://github.com/splunk/splunk-connect-for-syslog/issues

    SC4S can be a very straightforward and simple way to implement syslog data collection. If you can follow these guidelines and avoid the gotchas you won’t have any issues when configuring Splunk Connect for syslog.

    If you have any additional needs or questions please contact TekStream and we’d be happy to assist you. 

  • Troubleshooting Null Field Values and Trailing Spaces

    Troubleshooting Null Field Values and Trailing Spaces

    By: Jeff Rabine | Splunk Consultant

    In my career as a Splunk Consultant, I have run across numerous occasions where I was thrown off by what I thought were null field values or trailing spaces where I didn’t expect spaces to exist. This can be confusing and even lead to inaccurate results. I will do my best to demonstrate these to you but in a real-world scenario, it’s never as obvious as a blog post.

    First here is an example of a search that is counting IP Addresses with an “Unknown” status. As you can see the results show zero:

    Empty String and Trailing example.

    Without knowing the data, the person writing this search could easily be done here. However, when we take a closer look, we notice there are 9 events with blank entries for Known_Bad_IP. But how could that be?!  We did a fillnull!

    Field values and trailing known for bad IP.

    The fillnull did not work because the fields are not null they contain empty strings. In this case, we can fix this by adding a replace command. To replace these empty string fields with Unknown:

    Field values or trailing spaces.

    As you can see now the search is working as expected.

    In my next example, we are coalescing IP addresses from two sources. As you can see, we are sorting the IP_Address column but it’s not sorting correctly.

    Empty string and trialing coalescing IP addresses.

    If we do an eval we can count the length of the field and as you can see, we have 10 character IP Addresses that are counting out as 11 characters.

    Empty string and trailing eval character length.

    Now if we look at the raw data, we can see that for some reason there is a trailing space on some but not all the IP addresses.

    Empty string and trailing space on some IP addresses.

    To fix this issue we would need to either fix the existing field extraction or add a new inline field extraction. Another option would be to use the trim command to trim the trailing space.

    Empty string and trailing inline field extraction.

    Empty string and trailing inline field extraction.

    Trim:

    Again, these are just lab examples of field values or trailing spaces. I experienced similar issues in the real world, but the errors were hiding in millions and billions of events. Sometimes you will run into cases where reports or field extractions are accurate 99.9% of the time but once a month a log source comes in that doesn’t work with your field extraction and causes the report to have inaccuracies. I hope this article will remind you to know your data and never assume anything. Happy Splunking!

    Want to learn more about any of these commands?  Contact us today!

  • Creating Custom Splunk Commands to Change Cron Schedules

    Creating Custom Splunk Commands to Change Cron Schedules

    By: Antonio Patino Noguez | Splunk Consultant

    In a customer environment, we noticed search latency at the top of every hour. After troubleshooting, I noticed that scheduled searches were set to run at the same time. Although it is simple to change the cron schedule for these searches through Splunk web, there were way too many searches, making the process painful. Using some filters and a REST call in a search, I could grab different batches of scheduled searches – but then I wondered, how can I change the cron schedules of these batches via search?  Splunk gives us the ability to create custom search commands. To create a custom command, you need to define the command in a commands.conf file. After the line of SPL is determined to be a custom command, Splunk checks the commands.conf and runs the corresponding Python script. Splunk passes each pipe of SPL through the script through STDIN and writes them out through STDOUT. Splunk then returns to the main search and completes the search. So, first things first, I needed to create both a commands.conf file and a Python script. By opening the text editor of my choice, I simply defined my command in a stanza and filled out the necessary attributes.  Here is an example of that:            [custom_command]            filename=cron_python.py            chunked=true            python.version=python3 Next, I need to create my Python script. The goal here was to collect all the scheduled searches that my search returned and iterate through them while changing their scheduled time to run. Leveraging the Splunk SDK, I have the following loop in my script:        for splrecord in records:            title = splrecord[‘title’]            cron_schedule = splrecord[‘cron_schedule’]            newtracker_update = service.saved_searches[str(title)]            #kwargs = {“cron_schedule”: self.cron_schedule}             kwargs = {                “cron_schedule”: self.cron_schedule,            } Now it’s time to bundle these files in a custom app. One important thing to remember to add to the app is the splunklib library. This is so the Python script can leverage the Splunk SDK. Since I gathered the schedule searches in “batches” via SPL, I could leverage my custom command to change the cron schedules just by running my search. It works like magic! In conclusion, creating custom commands can really help tackle specific tasks that may not be easily handled with out-of-the-box Splunk enterprise. This allows for flexibility to handle virtually all issues that may arise in your Splunk environment. For further reading, here are The 3 Most Common Splunk Issues and How to Solve Them.

    Got a unique Splunk issue? TekStream can help you solve it. Contact us today. 

  • Leveraging Accounts Payable Automation to Address and Overcome Challenges

    Leveraging Accounts Payable Automation to Address and Overcome Challenges

    By: Andrew Blackman | Founder & CEO of EZ Cloud, a TekStream Partner

    Accounts Payable (AP) is an integral part of the way organizations operate. While recognized as a support in maintaining profitability, AP departments have traditionally completed processes manually. Why though? It can be inefficient, prone to error, and can be costly. Unfortunately, many companies experience the same AP challenges:
    • • While your particular business processes have evolved and progressed, your accounts payable methodology may still rely heavily on paper. Even if invoices are received via email, many organizations still require that invoices to be printed, processed, approved, and stored manually. This further complicates an already tedious process.
    • • Paper dependency exists even though companies have an ERP system (or multiple ERP systems, including but not limited to E-Business Suite, PeopleSoft, and JD Edwards). ERPs are meant to handle the accounts payable process in an efficient manner.
    • • Employees may only be proficient in one system and not others. Who has time to learn yet another system?
    • • Other employees need to process or approve invoices, but they don’t have ERP authorization.
    Maintaining the accounts payable methodology the same way “it’s always been done” is a risk. However, maintaining manual processes may be stifling organizational growth. AP is a historically manual and time-consuming process that often contributes to delays. While other aspects of business have been made more efficient through the use of automation, often, AP departments have still had to rely on manual processes. Accounts Payable automation offers an improved user experience and rich toolset to streamline invoice data entry, focusing on the automation of invoice data input.  This high level of automation will lower the number of data elements keyed, which in the end reduces the number of possible clerical errors. Leadership is seeing a greater need to keep up with the times and transition to leveraging Accounts Payable automation technology in improving their tech stack. An organization having visibility into AP via an automated system is incredibly helpful for promoting growth and development. Investments previously made in other areas of your business can be leveraged.
    • • Integration points, based on standard defined points within your ERP, quickly retrieve the purchase order and vendor information. From there, it will match the data to the invoice often before a user has any visible interaction with the invoice.
    • • Any current validation routines present in your ERP are honored, as data is validated before its delivery to the ERP for ingestion.
    • • Any existing approval hierarchies from the ERP can be reused for workflow approvals which can often be simply approved via email.
    • • Your existing corporate security model and infrastructure can be used to enforce authentication and authorization of invoice information.
    • • Invoice-related documentation can be attached to the invoice, and subsequently viewed in the ERP.
    Integrating with your existing ERP(s), EZ Cloud’s Accounts Payable automation solution supports your current workflow needs while digitizing and automating processes. Recognizing that no ERP is ever deployed “out of the box,” EZ Cloud and TekStream work together to tailor the solution to your specific needs. Once manual processes are left behind, your AP department will quickly thank you!

    Contact TekStream today to learn more about how our team can help to solve challenges in the accounts payable process.

  • Phishing Playbook Template Walkthrough

    Phishing Playbook Template Walkthrough

    By: Forrest Lybarger | Senior Splunk Consultant

    Your analysts should spend more time doing analysis and investigation. Our Splunk SOAR (Cloud) Phishing playbook template walkthrough offers a visual platform for generating a playbook without writing code, so you can automate security procedures.

    Below is a picture of the top-level phishing playbook template. I used comment blocks to note what should happen where in the playbook because playbook blocks require an existing playbook to name them and don’t allow notes. It is intended to give guidance on the process flow. Making templates for the sub-playbooks is largely unnecessary since those can vary between customers, and most are simple linear playbooks. I will cover the playbook going top to bottom.

    Top-level Splunk playbook screenshot.

    Email Extraction:

    Extract block for email file. This could change depending on how the phishing emails are being sent to Phantom. Extract IOC is a common method of parsing. The output will be various artifacts, for example, Email, URL, and Domain. Use extract IOC for .eml files.

    Precheck:

    Check email against a list of checks for whitelisting and blacklisting. This will save time and resources. Use custom lists to store whitelisted and blacklisted values like domains and IP addresses. Many internal emails can be whitelisted this way, especially if users are the ones flagging phishing emails.

    Whitelisted:

    Build a sub-playbook to process whitelisted events. It can perform many actions, including sending a notification email to the submitter or ticket creation coupled with immediate closure for record keeping. Talk to the customer about what they want to do.

    Blacklisted:

    Add a sub-playbook here to process blacklisted emails. Example actions to run: notification emails, ticket creation, isolation/triage. Talk to the customer about what they want to be done here.

    Other:

    Below, the playbook will branch out into multiple sub-playbooks to evaluate whichever items the consultant or customer deems helpful in determining the risk score of the email. They are broken up to maintain the readability of the top-level playbook while giving a detailed view of how the process works. A ticket in a 3rd party system like ServiceNow or JIRA can be opened here to record operations runs and their results (if the customer uses such a service). Don’t put all these sub-playbooks into a single playbook; that would be less readable and could result in one small part of the playbook interfering with more parts. Isolate them to improve readability and make maintenance easier.

    Domain Evaluation:

    Evaluate the domain artifacts created by using extract IOC. Discuss with the customer what API they will use to perform these checks. I recommend steering them toward any API that has an app on Phantom.

    If the API they choose doesn’t have an app, then the consultant will have to code the API call themselves. Not only is this time-consuming, but once the consultant rolls off the project, someone else will have to maintain that code. The customer will likely not have control over the changes made to the API, so if the API changes, whoever maintains the code will have to edit it. Phantom apps are maintained by Splunk or the API developer, so the customer won’t have to do much maintenance.

    URL Evaluation:

    Evaluate URL artifacts in a sub-playbook by sending the URLs as inputs. Again, try to use an API with an existing Phantom app. If the API doesn’t have an entry for the URL, a submission should be run. Waiting for this submission to be finished will take time (5-15 min), so it would be better to just submit it in the playbook and have a manual review check for the score later when it’s done processing. Otherwise, custom code will have to be run to wait for the results, which will stall the whole playbook and could cause a backlog of emails.

    IP Evaluation:

    Evaluate the IP address of the email sender. When parsing .eml files with extract IOC, the IP address can be found in the Authentication-Results field in the email artifact. An ipv4 extract block can get the IP address without custom code. Customers might want multiple kinds of data to be evaluated here, like geolocation and reputation. Splunk has its own app for IP geolocation, which gives different fields for latitude, longitude, city, state, country, address, etc. A custom list will come in handy to whitelist/blacklist locations.

    File Evaluation:

    Use a sub-playbook to evaluate and/or detonate any attached files. Ignore image files since they won’t run anything and will be too common to process them all. Search for pre-existing entries using the hash included in the vault artifact corresponding to the file. If there isn’t an existing entry, submit the file; similar to the URL submissions, it is better to have the manual review check the score after the submission is done processing.

    Score Assessment:

    Using results from the branching eval playbooks, determine an overall score or a group of scores to be evaluated against thresholds in the following decision block. Example methodologies: weighted average, highest, weighted average of highest values. Use custom lists for weights.

    Post check:

    Evaluate the risk of the email by comparing it to thresholds inputted into this block. There are many different options to go with, but it will probably be best to start with low thresholds and increase them depending on volume and accuracy.

    Safe:

    Use another sub-playbook for processing emails determined to be safe. Example actions: send notification emails, open/close tickets, etc. Discuss these actions with the client.

    Dangerous:

    Use another sub-playbook for processing emails determined to be dangerous. Example actions: send notification emails, open/close tickets, etc. Discuss these actions with the client.

    Want to learn more about creating a phishing playbook template in Splunk SOAR (Cloud)? Contact us today!

  • Configuring Splunk-Connect-for-Syslog with HTTP Event Collector Using Podman

    Configuring Splunk-Connect-for-Syslog with HTTP Event Collector Using Podman

    By: Oluwaseun Oke

    Splunk Connect for Syslog is an open source packaged solution for getting data into Splunk. It is based on the syslog-ng open source Edition (Syslog-NG OSE) and transports data to Splunk via the Splunk HTTP event collector (HEC) rather than writing events to disk for collection by a Universal Forwarder.

    According to Splunk.github.io “Splunk Connect for Syslog is a containerized distribution of syslog-ng with a configuration framework designed to simplify getting syslog data into Splunk Enterprise and Splunk Cloud. Our approach is to provide a runtime-agnostic solution allowing customers to deploy using the container runtime environment of choice.”

    Diagram titled “The Magic of SC4S Log-Path Filters” showing Cisco ASA firewall events flowing via TCP/UDP port 514 into SC4S (Splunk Connect for Syslog), which applies a Cisco ASA filter and sends data to Splunk using the HEC (HTTP Event Collector) protocol. Emphasizes the process: Identify > Parse > Format.

    For this demo we are going to use two (2) servers; Podman/SC4S server and Splunk (all-in-one) server.

    Podman: Podman is a daemonless, rootless container engine developed which allows containers to be run by non-root users. The best recommendation is to use CentOS 8. As such there are certain configurations that are necessary to be ensure a seamless installation.

    Splunk (aio): We can use the regular amazon linux instance or Centos 8 but we will be using the regular Amazon linux for this demo

    Splunk Installation
    Install Splunk and have it running using regular Splunk installation.
    Configuring SC4S using Podman.

    Podman Configuration

    Please run the following commands below to update the Centos 8 with the necessary updates (please note that this only necessary for Centos 8) on the sc4s/podman server.

    # cd /etc/yum.repos.d/
    # sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/CentOS-*
    # sed -i ‘s|#baseurl=https://mirror.centos.org|baseurl=https://vault.centos.org|g’ /etc/yum.repos.d/CentOS-*

    After which we are going to swap the centos-linux-repos to the centos-stream-repos (Appstream) for Centos 8 which is used for setting up the Podman and we are going to sync it the Appstream repos we are replacing.

    # dnf –disablerepo ‘*’ –enablerepo=extras swap centos-linux-repos centos-stream-repos
    # dnf distro-sync

    Terminal output showing the CentOS 8 system swapping out centos-linux-repos for centos-stream-repos using the dnf package manager. Confirms installation and removal details.

    ******Switch to your Splunk Server****

    Create Indexes

    SC4S is pre-configured to map each sourcetype to a typical index. Since this is a new installation, it is best practice to create them in Splunk when using the SC4S defaults as shown below. Please note that SC4S can be easily customized to use different indexes if desired.

    • • email
    • • epav
    • • epintel
    • • infraops
    • • netauth
    • • netdlp
    • • netdns
    • • netfw
    • • netids
    • • netlb
    • • netops
    • • netwaf
    • • netproxy
    • • netipam
    • • oswin
    • • oswinsec
    • • osnix
    • • print
    • • em_metrics (Optional opt-in for SC4S operational metrics; ensure this is created as a metrics index)

    Please go to the Splunk web and confirm if the indexes have been created.

    Splunk index list interface showing various system indexes such as _thefishbucket, em_metrics, email, and others. Each row includes edit options, index type, source type, storage path, and status indicators.

    Configure the Splunk HTTP Event Collector

    We are going configure the Splunk HTTP Event Collector by creating a HEC token and make it global to help stream the data from the SC4S/Podman container to the Splunk Server indexers. It is strongly recommended that SC4S traffic be sent to HEC endpoints configured directly on the indexers rather than an intermediate tier of HWFs. It is recommended that the “Selected Indexes” on the token configuration page be left blank so that the token has access to all indexes, including the “lastChanceIndex. If this list is populated, extreme care must be taken to keep it up to date, as an attempt to send data to an index not in this list will result in a 400 error from the HEC endpoint.

    Switch to the SC4S/Podman Server to begin the installation of the Podman container

    Need to enable and the update the powertools to help with the installation of the “Podman”

    # sudo dnf config-manager –set-enabled powertools

    # sudo dnf -y update

    We going to confirm if we have the container-tools needed to install Podman

    # sudo dnf module list | grep container-tools

    Terminal output of sudo dnf module list | grep container-tools, listing multiple versions of the container-tools module for RHEL 8. Each version includes tooling like podman, buildah, and skopeo.

    After the confirmation, we can now install Podman

    # sudo dnf install -y @container-tools 

    Always confirm the installation by checking the Podman version by running:

    # podman version

    Terminal output showing the installed Podman version. Lists version 4.0.2, API version, Go version, build timestamp, and OS architecture.

    CONGRATS!!!!!!

    Now we would want to confirm that we can check the version of the OS from Podman:

    # podman run -it –rm alpine sh

    / # cat /etc/os-release

    Terminal session of running an Alpine Linux container using Podman. Shows successful image pull and startup. Inside the container, the /etc/os-release file is displayed, confirming Alpine Linux v3.15.4.

    Now you can get out of the Podman container  to the OS level by typing:

    # exit

    Implement a Container Runtime and SC4S

    The following script can be saved in a GitHub repository which can be called with “wget” in the cli:

    #!/bin/bash
    # 14/03/2022 John Barnett
    # Script created on / for CentOS 8
    # 21/07/2021 – Added TLS Remix, added TLS listener – note creates a default cert below so edit / remove as required
    # 14/03/2022 – Updated default container pull to version 2
    ### Based on quick start here – https://splunk.github.io/splunk-connect-for-syslog/main/gettingstarted/podman-systemd-general/
    # Set URL and Tokens here
    # SplunkCloud Example
    # HEC_URL=”https://http-inputs-MYSTACKNAME.splunkcloud.com”
    HEC_URL=”https://3.134.109.163:8088″
    HEC_TOKEN=”e5f1032d-b0a2-4cd2-8010-2411ce6b7552″
    #hostnamectl
    #hostnamectl set-chassis server
    #hostnamectl set-location rack1
    #hostnamectl set-hostname sc4sbuilder
    hostnamectl

    ################################################################################
    ########### Dont edit below here, unless you know what you are doing ###########
    ################################################################################
    red=`tput setaf 1`
    green=`tput setaf 2`
    yellow=`tput setaf 3`
    reset=`tput sgr0`
    echo “${yellow}Check date and TZ below!${reset}”
    date
    echo “${yellow}Updating Firewall Rules${reset}”
    #Show original state
    firewall-cmd –list-all
    #Splunk ports
    firewall-cmd –zone=public –add-port=514/tcp –permanent # syslog TCP
    firewall-cmd –zone=public –add-port=514/udp –permanent # syslog UDP
    firewall-cmd –zone=public –add-port=6514/tcp –permanent # syslog TLS
    firewall-cmd –zone=public –add-port=5425/tcp –permanent # syslog
    firewall-cmd –zone=public –add-port=601/tcp –permanent # syslog
    firewall-cmd –reload
    #Check applied
    firewall-cmd –list-all
    dnf install -y conntrack podman
    echo “
    ## Edited with JB Splunk Install script by magic
    net.core.rmem_default = 17039360
    net.core.rmem_max = 17039360
    ” >> /etc/sysctl.conf
    sysctl -p
    echo “
    ## Created with JB Splunk Install script by magic
    [Unit]
    Description=SC4S Container
    Wants=NetworkManager.service network-online.target
    After=NetworkManager.service network-online.target
    [Install]
    WantedBy=multi-user.target
    [Service]
    Environment=”SC4S_IMAGE=ghcr.io/splunk/splunk-connect-for-syslog/container2:2″
    # Required mount point for syslog-ng persist data (including disk buffer)
    Environment=”SC4S_PERSIST_MOUNT=splunk-sc4s-var:/var/lib/syslog-ng”
    # Optional mount point for local overrides and configurations; see notes in docs
    Environment=”SC4S_LOCAL_MOUNT=/opt/sc4s/local:/etc/syslog-ng/conf.d/local:z”
    # Optional mount point for local disk archive (EWMM output) files
    Environment=”SC4S_ARCHIVE_MOUNT=/opt/sc4s/archive:/var/lib/syslog-ng/archive:z”
    # Uncomment the following line if custom TLS certs are provided
    Environment=”SC4S_TLS_MOUNT=/opt/sc4s/tls:/etc/syslog-ng/tls:z”
    TimeoutStartSec=0
    ExecStartPre=/usr/bin/podman pull $SC4S_IMAGE
    ExecStartPre=/usr/bin/bash -c “/usr/bin/systemctl set-environment SC4SHOST=$(hostname -s)”
    ExecStart=/usr/bin/podman run \
    -e “SC4S_CONTAINER_HOST=${SC4SHOST}” \
    -v $SC4S_PERSIST_MOUNT \
    -v $SC4S_LOCAL_MOUNT \
    -v $SC4S_ARCHIVE_MOUNT \
    -v $SC4S_TLS_MOUNT \
    –env-file=/opt/sc4s/env_file \
    –health-cmd=”/healthcheck.sh” \
    –health-interval=10s –health-retries=6 –health-timeout=6s \
    –network host \
    –name SC4S \
    –rm $SC4S_IMAGE
    Restart=on-abnormal
    ” > /lib/systemd/system/sc4s.service
    sudo podman volume create splunk-sc4s-var
    sudo mkdir /opt/sc4s/
    mkdir /opt/sc4s/local
    mkdir /opt/sc4s/archive
    mkdir /opt/sc4s/tls

    echo “
    ## Created with JB Splunk Install script by magic
    # Output config
    SC4S_DEST_SPLUNK_HEC_DEFAULT_URL=$HEC_URL
    SC4S_DEST_SPLUNK_HEC_DEFAULT_TOKEN=$HEC_TOKEN
    #Uncomment the following line if using untrusted SSL certificates
    SC4S_DEST_SPLUNK_HEC_TLS_VERIFY=no
    # TLS Config, for McAfee etc
    SC4S_SOURCE_TLS_ENABLE=yes
    SC4S_LISTEN_DEFAULT_TLS_PORT=6514
    #SC4S_SOURCE_TLS_OPTIONS=tls1.2
    #SC4S_SOURCE_TLS_CIPHER_SUITE=ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
    ” > /opt/sc4s/env_file
    echo “${yellow}Generating Cert for TLS${reset}”
    openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -subj “/C=NZ/ST=NI/L=Home/O=SC4S Name/OU=Org/CN=sc4sbuilder” -keyout /opt/sc4s/tls/server.key -out /opt/sc4s/tls/server.pem
    echo “${yellow}Your /opt/sc4s/env_file looks like this${reset}”
    cat /opt/sc4s/env_file
    echo “${yellow}Starting SC4S – This might take a while first time as the container is downloaded${reset}”
    sudo systemctl daemon-reload
    sudo systemctl enable –now sc4s
    # Send a test event
    echo “Hello MYSC4S” > /dev/udp/127.0.0.1/514
    sleep 10
    sudo podman logs SC4S
    sudo podman ps
    # Sleep to allow TLS to come up
    sleep 20
    netstat -tulpn | grep LISTEN
    #### Use command below and then type to test
    #openssl s_client -connect localhost:6514
    #### Use command below for full tls test if required (adjust as needed)
    #podman run -ti drwetter/testssl.sh –severity MEDIUM –ip 127.0.0.1 sc4sbuilder:6514

    Terminal session showing SC4S startup, system port listening status via netstat -tulpn | grep LISTEN, and a podman container for SC4S running. Additional commands for TLS testing and container-based SSL validation are listed.

    After the installation and configuration, we should be able to see the data coming in on the Splunk Server.

    Screenshot of a Splunk search interface showing indexed SC4S logs. The event table includes timestamps, host, source, source type, and log messages such as HEC test events and syslog-ng configuration notices.

    Steps to Creating a custom Index and Filtering

    Custom Index creation

    1. Create the custom index in Splunk before editing sc4s
    2. Move to the sc4s directory: cd /opt/sc4s/local/context
    3. Create a file “splunk_metadata.csv” to create custom indexes and events and place the following in file: vi splunk_metadata.csv
      name of the application, index, name of the index (example is shown below)
      vi splunk_metadata.csv
      test_sourcetype, index, org_test_index
      test_sourcetype, source, mytest
    4. Save the file and restart sc4s service
      # systemctl restart sc4s
    5. Check the status of sc4s to confirm the update made to the splunk_metadata.csv file
      # systemctl status sc4s

    Filtering
    Use case: Exclude a host “sc4s_vendor_product

    1. Move to the sc4s directory: cd /opt/sc4s/local/context
    2. This will involve 2 conf files in the “context” directory: “vendor_product_by_source.conf” and vendor_product_by_source.csv.
      First edit the “vendor_product_by_source.csv” specify the filter and field name

    vi vendor_product_by_source.csv

    f_null_queue,sc4s_vendor_product,"null_queue"

    and save the file

    vi vendor_product_by_source.conf
         filter f_null_queue {
               host(‘192.168.12.1’)
         };

    and save file

    1. Restart sc4s service
      # systemctl restart sc4s
    2. Check the status of sc4s to confirm the update made to the splunk_metadata.csv file
      # systemctl status sc4s

    Use case: Exclude events with the word “deny”

    1. Move to the sc4s directory: cd /opt/sc4s/local/context
    2. This will involve 1 conf file in the “context” directory: “vendor_product_by_source.conf”

    vi vendor_product_by_source.conf

    filter f_null_queue {
         message(‘deny’)
    };

    1. Save the file and restart sc4s service
      # systemctl restart sc4s
    2. Check the status of sc4s to confirm the update made to the splunk_metadata.csv file
      # systemctl status sc4s

    Additional Resources

    Splunk Connect for Syslog
    TechGlimpse Blog
    TekStream Resources
    Splunk
    Podman

    HAPPY SPLUNKING!!!!!!!!!!!!!

  • Automating the Deployment of a Highly Available Hosting Environment in WordPress

    Automating the Deployment of a Highly Available Hosting Environment in WordPress

    By: Jay Almers | Senior Cloud Solutions Architect

    Recently, TekStream was engaged by a customer to develop an automated method of building out a highly available hosting environment that could serve multiple WordPress websites.  The solution should be implemented with Infrastructure as Code (IaC) for simplicity of management and disaster recovery purposes.  Additionally, the customer requested a method for the creation and maintenance of WordPress websites on this hosting environment.  If you read our blog post about automating the process of gathering and evaluating data in your AWS accounts, you know that we are fans of utilizing automation whenever possible to perform repetitive tasks.  After our initial discovery sessions, it was apparent that this project was the perfect candidate for automation using CloudFormation Stacks for provisioning the infrastructure and Ansible for the configuration and management of software.

    WordPress is an open-source Content Management System (CMS) that is written in PHP and uses a MySQL database for the storage of content and settings. In order for us to build out the necessary infrastructure to support these WordPress sites, we needed to ensure all the software’s requirements were satisfied.

    A team consultation with the customer drove the decision to implement a LAMP stack for this project based on their own familiarity and skill set. “LAMP” is an acronym that is commonly used to refer to the combination of technologies for the creation and delivery of web-based applications, in this case, Linux, Apache, MySQL, and PHP. The Word Press sites would be served on a cluster of EC2 instances running Amazon Linux, Apache 2.4, and PHP 7.4. The database was served by a cluster of Amazon Aurora MySQL instances.

    The database was served by a cluster of Amazon Aurora MySQL instances.

    With our list of requirements defined, the TekStream team began developing our Infrastructure as Code “stack” to provision all the backing environment. Using the CloudFormation interface, our customer inputs values for various parameters that the system uses when building out the infrastructure such as desired IP address ranges, the primary fully qualified domain name (FQDN) that will be used for the Cloud Front distribution, number of EC2 instances to provision, and the instance class size for the database cluster to name a few. Execution of this stack results in a new Virtual Private Cloud (VPC) containing multiple EC2 instances in private subnets spanning several Availability Zones (AZ). The EC2 instances are load balanced by an Application Load Balancer (ALB), fronted by a Cloud Front distribution which caches the sites and delivers them from a global network of edge locations and takes advantage of shared persistent storage mounts provided by EFS. Additionally, a cluster of RDS instances that is configured for fault tolerance and automatic failover, provide our environment with a highly available database system. If provisioned manually, all components of this system would take a significant amount of time and effort to configure and implement. Without Infrastructure as Code and CloudFormation, this 15-minute process could take hours to complete with potentially varying results.

    Ansible is an open-source product of Red Hat.

    Now that our environment has been successfully provisioned, we can now move on to the next part of this project.  Ansible is an open-source product of Red Hat that is used for automating the provisioning, configuration, and deployment of software and systems.  Ansible is a phenomenal utility that is capable of automating processes and procedures on a single device such as a Cisco router to a fleet of thousands of servers.  For this project, we are using Ansible to establish an SSH connection to the instances in our EC2 cluster and then executing a series of commands on our behalf.  Our EC2 instances, or “hosts”, are defined in our Ansible configuration as an “inventory”.  The group of instructions that tell Ansible what to do, and how to do it, is called a “playbook”.  The idea is that any time the customer needs to create a new WordPress website, they will run this playbook and all the tedium and error-prone configuration is handled for them.  When the playbook is first run, the user is prompted for customization of the configured parameters such as site title, URL, administrative username, etc.  After all parameters have been provided, either by accepting the default values or by entering overriding information, the playbook begins iterating through each configured host in the inventory.  First, Ansible connects to the EC2 instance with SSH and verifies the existence of specific packages and ensures they are up to date using the Operating System’s native package manager.  Next, a local VirtualHost configuration template is populated with the appropriate details provided by the customized parameters when the playbook was first executed.  This customized template is then stored on the persistent EFS storage as an Apache configuration file.  Ansible then creates the directory defined in the configuration file as the DocumentRoot on the persistent EFS storage, where the WordPress core files will be downloaded and stored.  It then executes several commands using the utility WP-CLI to configure and install the WordPress site with the customized parameters collected at runtime.  Since each EC2 instance in our cluster is configured to look in our shared storage mounts for VirtualHost configuration files and site DocumentRoot directories, Ansible only needs to install and configure our sites on a single host.  However, Apache needs to be restarted on each host to take advantage of any changes to configuration that may have occurred.  The final step in this process, connects to each remaining host in the inventory and restarts Apache.  When the whole process is complete, the user is then provided a summary of the tasks that were run as well as the administrative information needed to log into the WordPress admin dashboard.

    If you would like more information on automation and how you may be able to leverage it to make your life a little easier, contact TekStream today!

  • Splunk Indexer Cluster Run Times

    Splunk Indexer Cluster Run Times

    By: Aaron Dobrzeniecki | Senior Splunk Consultant

    Have you ever wondered how you can check your indexer cluster run times are performing? Of course, there are a multitude of dashboards and statistics you can pull from the Monitoring Console to use to show the health of your indexer cluster run times. While working on a project for one of our large Splunk customers, my colleague, Antonio Patinonoguez, and I produced the idea to create a simple synthetic search for each of our indexer clusters. From these saved searches, we can pull out the total_run_time each time the searches run and find the indexer cluster run time each time the search runs. Below are the details:

    Let us say for example your environment has 3 different indexer clusters and we want to see the run time for our synthetic searches over time to see when we receive extremely high spikes in run time. You will create a saved scheduled search that runs every minute looking back 1 minute. Please see the simple search below:

    **NOTE** You need to have your splunk_server match your indexers naming format. index=_internal splunk_server=*idx1_cluster* lhead 100

    You can create a scheduled search for each of your indexer clusters or if you have one cluster, you can create it for each indexer. This is just a simple search, searching the internal logs that were indexed on the indexer cluster, returning the first 100 events.

    Configuration screen for a Splunk report scheduled using Cron expression to run every minute with highest priority.

    Once enough time has passed (maybe a few days of collecting metrics), you can take the below search and see your synthetic search run times over X amount of time in the past. The run times are stored in the _audit index which will keep data for 30 days by default. Please see the screenshots below of the current searches we have set up in this environment.

    index=_audit savedsearch_name IN (“idxclust1_synthetic_search_test”, “idxclust2_synthetic_search_test”, “idxclust3_synthetic_search_test”) | stats  latest(total_run_time) by savedsearch_name

    With our help, you can also build a dashboard as shown in the screenshot below. The top panel is the following search, this gives us the absolute latest run time for our scheduled synthetic search in seconds. As you can see, indexer cluster 1 has an exceedingly high run time for our synthetic search at 71.5 seconds. For one simple search like we have for this, the desired results are what cluster 2 and 3 are currently at. We do not want high run times.
    What might cause high run times you ask? There could be an exceptionally LARGE number of searches stemming from that certain indexer cluster causing extreme amounts of CPU usage. There could also be long-running or bad searches that are taking up too much memory. Numerous issues could be the cause of high run times.

    The top panel in this screenshot is the search below, there is a total_run_time field that pulls out the total time it took the synthetic search to run. Having a low search run time can show that your indexers are processing searches in a healthy manor.

    The second panel in this screenshot is the timechart of the last X amount of time in the past. We have added a time-picker to our dashboard for this.

    Splunk dashboard displaying run times by minute and historical trends across three panels, highlighting performance variability.

    This dashboard we created helps us dig into and troubleshoot when indexer clusters have high synthetic search run times. In the screenshot below you will see my mouse on the largest point on the graph for indexer cluster 1. By clicking on this point, we open two more panels that show:

    1. Thirty minutes before and after where I clicked on the graph (with a dotted line showing where I clicked); the max historical searches by search head cluster/search heads in the environment.
    2. Thirty minutes before and after where I clicked on the graph (with a dotted line showing where I clicked); the max active searches on that specific indexer cluster.

    Graph zoomed in on a specific spike in run time on June 20, 2022 at 10:05 AM showing 171.75 seconds.
    Line graph showing max historical searches by different search head clusters over time on June 20, 2022.
    Line chart displaying peak active searches on the indexer farm, highlighting a sharp increase around 10:05 AM.

    From these two panels, you can click on any point on either panel which will open a separate dashboard related to the panel you clicked. This dashboard is interactive and provides a LOT of vital information regarding how well your indexer clusters/indexers are performing, as well as ALL the long-running searches happening on a specific search head clusters (Just by clicking a point on the max hist searches by search head cluster panel!). For more help Wrangling your Splunk indexers check out this blog.

    For more information about our incredible Indexer Cluster Metrics dashboard, please reach out to the TekStream Solutions Splunk team!

  • Routing Data to Multiple Destinations

    Routing Data to Multiple Destinations

    By: Zubair Rauf | Senior Splunk Consultant

    Splunk is a very powerful tool that allows you to transform your data and parse it the way you want to in most cases. Using some basic Splunk functionality, you can route data to multiple destinations, may it be multiple indexes, indexers, or even other destinations. This can help you address different scenarios where you may want to have data from a single source go to multiple destinations. While there can be many use cases you can address with this, we will touch upon a few use-cases that I have come across during my years of work with Splunk.
    •   • Route data to multiple destinations from a Splunk Universal/Heavy Forwarder using inputs.conf
    •   • Route data to multiple destinations using props/transforms

    Route Data to multiple destinations from Splunk UF/HF using inputs.conf

    There can be multiple use-cases where you would want to use inputs.conf to route your data to multiple destinations. Some of the most common use-cases I’ve seen are
    •   • Customers need to send data to other external tools outside of Splunk.
    •   • Customers in a hybrid cloud/on-prem environment needed to send the same data to Splunk Cloud indexers and their Splunk on-prem (Enterprise) indexers
    Before we dive deeper into this, if you are sending data externally outside of Splunk over Syslog, in Splunk you will need a Splunk Heavy Forwarder (HF). You can route data from multiple UFs to a single HF that can send data over Syslog to an external source. On the universal forwarder, you can set multiple output destinations using multiple target groups. These can include the following;
    •   • TCP 9997 to Splunk servers
    •   • TCP to non-Splunk servers using the “sendCookedData=false” setting
    Splunk Heavy Forwarders can also send Syslog data to third-party systems over TCP and UDP protocols. If your third-party system accepts data over Syslog then you can route data from your UFs to HFs and further to the Syslog endpoint.

    Routing data using inputs.conf on a Universal Forwarder

    You can create multiple target groups in the outputs.conf

    Universal Forwarder

    ##outputs.conf [tcpout] defaultGroup = splunk-target-indexers  [tcpout:splunk-target-indexers] server = x.x.x.x:9997  [tcpout:non-splunk-target-group] server = x.x.x.x:port sendCookedData = false [tcpout:splunk-heavy-forwarder] server = x.x.x.x:9997 A universal forwarder will route data to the default group if you do not specify a different destination using the _TCP_ROUTING attribute for your input. ##inputs.conf # This will route to default group [monitor:///var/log/abc.log] index = os_nix sourcetype = abc-log # This will route to splunk-target-indexers and non-splunk-target-group [monitor:///var/log/def.log] index = os_nix sourcetype = def-log _TCP_ROUTING = splunk-target-group,non-splunk-target-group

    Routing and filtering data on the Heavy Forwarder

    You can use the heavy forwarder to do advanced routing and filtering. You can send data out of Splunk using the Syslog server and also use props and transforms to route a subset of data to certain destinations. ##outputs.conf [tcpout] defaultGroup = splunk-target-group [tcpout:splunk-target-group] server = x.x.x.x:9997 [tcpout:non-splunk-target-group] server = x.x.x.x:port sendCookedData = false [syslog] defaultGroup = syslogGroup [syslog:syslogGroup] server = ipddress:port OR hostname:port type = udp|tcp

    Route data to Syslog

    In the example, we will see how a subset of events are routed to Syslog ##transforms.conf #Create a transform to route data [send-to-syslog] REGEX = . #This will capture all events, you can write a regex to capture specific events DEST_KEY = _SYSLOG_ROUTING FORMAT = syslogGroup ##props.conf #Route data from a specific host to syslog [host::somehost*] TRANSFORMS-syslog_output = send_to_syslog #Route a specific sourcetype to syslog [sourcetype::some-sourcetype] TRANSFORMS-syslog_out = send_to_syslog Splunk transforms are very powerful and allow you to transform, filter and route your data in multiple ways. To learn more about what transforms can do, you can review the documentation here.

    If you have Splunk routing or data filtering questions, please contact Zubair and our Splunk developer team for more info:

  • Splunk Cloud App Vetting Made Simpler!

    Splunk Cloud App Vetting Made Simpler!

    BY: Bryan Bollou | Splunk Consultant

    Whether you want to get an app approved or create a new sourcetype in Splunk Cloud, the cloud vetting process can be an exhausting exercise in vetting involving you and the cloud ops team. This post will show you how to leverage the Splunk App Inspect API, as well as common pitfalls to avoid so that your app gets approved for installation.

    From an on-prem Splunk instance access the Splunk GUI to create a new app on your instance. Set a name, folder name, set visibility to “No”, and the template to barebones.

    Screenshot of Splunk Enterprise UI showing the creation of a new custom app with form fields like name, folder and description.

    Access the CLI of the machine you did this on through SSH or locally. Navigate into the directory where the template app was created; $SPLUNK_HOME/etc/apps.

    Terminal window displaying the contents of the Splunk apps directory, listing default and custom app folders.

    This directory will be the template for creating the app. It is easier to start from this template as it will have the necessary default files and a structure to start from.

    Terminal view of the internal structure of a custom Splunk app folder, including default, local, and metadata directories.

    In this example we are looking to create a custom app that will modify a sourcetype in a Splunk Cloud deployment.

    To figure out what props.conf changes need to be made for the sourcetype;
    Get the raw data you are trying to parse.
    Upload data through the “Add Data” section in Splunk.
    Select a source and drop in the data file.
    Now you can create a custom sourcetype.

    Splunk interface showing data preview from an uploaded XML file, with parsed event data and timestamp detection options.

    Go to “Advanced” and enter the appropriate fields to correctly parse your sourcetype.
    These can be new settings for; time_prefix, max_timestamp_lookade, time_format, etc.

    Save the setting and check if the parsing is working as you want it. Hit “preview” to see the necessarily props.conf settings.

    Popup window in Splunk displaying suggested props.conf settings for a new sourcetype, ready for copy and paste.

    Example of resulting props.conf stanza:

    [new_sourcetype_dreamcrush]
    SHOULD_LINEMERGE=false
    LINE_BREAKER=</Interceptor>([rn]+)
    NO_BINARY_CHECK=true
    CHARSET=UTF-8
    disabled=false
    TIME_FORMAT=%Y-%m-%d</ActionDate>
    TIME_PREFIX=<ActionDate>
    Go back to the machine with the app template directory.

    If a props.conf needs to be created, create, and set it to the proper permissions for Splunk custom apps (700 for directories and 600 for files). Append the setting you created to the $SPLUNK_HOME/etc/apps/appname/props.conf of your app.

    Commands
    cd $SPLUNK_HOME/etc/apps/appname/
    touch props.conf
    chmod 600 props.conf
    vi props.conf

    Terminal window showing the creation and contents of a props.conf file for configuring a new sourcetype in Splunk.

    If this is a one-time custom app, such for creating a sourcetype, add the following stanza to the $SPLUNK_HOME/etc/apps/appname/app.conf.

    [package]

    check_for_updates = 0

    Terminal output displaying the contents of a Splunk app.conf file defining app visibility, author, and version.

    Next, there should only be a default directory in the custom app. If you are modifying an app through the GUI however, it will create files in the local directory. Make sure you move the necessary files and merge the configs in the default directory. NOTE: You should also remove the bin directory, which would be where you place scripts, if it is not needed.

    Commands
    cd $SPLUNK_HOME/etc/apps/appname/
    rm -rf local
    rm -rf bin

    As bare minimums, you only need the default and metadata directories.
    Make sure the parent app directory has “execute” permissions.

    The following commands will set all the files’ permissions to 600 and all directories’ permissions to 700 – the standard for Splunk custom apps. Run this inside the root folder of your app ($SPLUNK_HOME/etc/apps/appname/). You can replace “/path/to/base/dir” with a period “.” to get every file/directory in and under the working directory.

    Commands
    find /path/to/base/dir -type d -exec chmod 700 {} +
    find /path/to/base/dir -type f -exec chmod 600 {} +

    You can then compress the directory into an archive using a command such as tar. This is packaging the app.

    NOTE: On a MacOS machine, there are temporary files created that will be denied by the cloud vetting process. To avoid this, a variable to not copy the temporary files (dot_underscore) must be set followed by the appropriate flag in the tar command.

    Commands
    export COPYFILE_DISABLE=1
    tar –exclude=”.*” -czvf test_template.tar test_template

    Terminal showing the full structure and packaging of a Splunk app folder into a .tar file for deployment or cloud vetting.

    Now let’s check if our app would pass the cloud vetting process – get ready for tons of failures and cryptic messages! For this we will use the Splunk App Inspect API that is well documented here; https://dev.splunk.com/enterprise/docs/developapps/testvalidate/appinspect

    For this article, we will be using the Postman Method.

    Sign up/into Postman then download the application from; https://www.postman.com/downloads/

    Import the Splunk AppInpsect Script from; https://dev.splunk.com/enterprise/docs/developapps/testvalidate/appinspect/useappinspectapi/ and import it into Postman.

    Postman import interface showing options to import API definitions including OpenAPI, GraphQL, and cURL for loading Splunk AppInspect scripts.

    Right-click menu open on the Splunk developer site to download the AppInspect Postman collection JSON file for import.
    Postman import confirmation screen showing AppInspect - Production collection ready to be imported as Postman Collection v2.0.

    Under your workspaces on the left you will see the AppInspect – Production collection.

    AppInspect - Production collection successfully loaded in Postman with endpoints including Authenticate, Submit, Status and Report options.

    You can then run the Authenticate script supplying your Splunk login and password to get an authorization token.

    Authenticate API request in Postman showing basic authentication with username and password fields, returning a success token and user information.

    Depending on the type of validation you need, you can then use one of the “script” POST scripts to submit your app tar by selecting the app_package KEY.

    You can then use the “status” GET script to generate the results of the validation based on the app you submitted.
    Finally, you will use the “report” GET scripts to grab the report results in either HTML or JSON format. This report will tell you if your app would pass the vetting process if you were to submit it through Splunk Customer as an app install, for example. Issues that will block the app are listed as failures and issues that should be fixed put wouldn’t cause a block are listed as warnings.

    Postman interface displaying an HTML report generated by the AppInspect API, previewing test results for the submitted Splunk app package.

    AppInspect HTML report summary showing validation results with 132 successes, 1 warning, and no errors or failures.

    If you followed the steps in this article. You will see that there are no failures, and this custom app would pass the cloud vetting.

    There is, however, 1 warning;

    check_kos_are_accessible

    • The ‘admin’ role is not available to Splunk Cloud customers. Please consider also including the ‘sc_admin’ role if you want Splunk Cloud customer administrators to be able to access this knowledge object File: default.meta Line Number: 5

    To change all the occurences of “admin” to “sc_admin” in the default.meta file use the following commands.

    Commands
    cd $SPLUNK_HOME/metadata
    vi default.meta
    :%s/admin/sc_admin
    :wq

    After making this change, if you compress the file and resubmit it through the Splunk AppInspect checks, it will have no failures/warnings.

    Follow-up HTML report summary with updated results showing 133 successful checks and zero warnings, errors, or failures for the Splunk app package.

    This custom app can then be submitted to be implemented in your Splunk Cloud environment without any issues!

    Depending on the type of custom app you are looking to vet, the error checks will be more numerous and can be cryptic. The error checks are listed here; https://dev.splunk.com/enterprise/reference/appinspect/appinspectcheck/  and you can see some of them are not very descriptive.

    The following are errors that can be encountered when trying to vet a dashboard app for Splunk Cloud and their possible solutions.

    1.

    check_that_extracted_splunk_app_contains_default_app_conf_file

    • Splunk App packages must contain a `default/app.conf file`. No `default/app.conf` was found  in `[redacted]`.

    An app.conf file must be created. Using a template from a barebones app from Splunk will do this but if one already exists in your local directory;

    Commands
    cd $splunkhome/etc/apps/appname/local
    mv app.conf ../default/app.conf

    2.
    check_that_local_does_not_exist

    • A 'local' directory exists in the app.

    You need to move all the files from local into default. You can either merge the two if both are populated or remove the default directory and rename the local one.

    Commands
    rm -r default
    mv local default

    3.
    check_for_bin_files

    • This file has execute permissions for owners, groups, or others. File: local/data/ui/views/[redacted].xml

    You need to change all fields to have 600 permissions and all directories to have 700 permissions.

    Commands
    find /path/to/base/dir -type d -exec chmod 700 {} +
    find /path/to/base/dir -type f -exec chmod 600 {} +

    4.

    check_simplexml_standards_version

    • Change the version attribute in the root node of your Simple XML dashboard local/data/ui/views/[redacted].xml to `<version=1.1>`. Earlier dashboard versions introduce security vulnerabilities into your apps and are not permitted in Splunk Cloud File: local/data/ui/views/[redacted].xml

    In all your dashboards, the Splunk standard is to have it with <dashboard> or <form>.

    Example
    Old:
    <?xml encoding=”UTF-8″?><version=”1.1″><form theme=”light”>

    New:
    <form theme=”light” version=”1.1″>

    5.
    check_for_sched_saved_searches_earliest_time

    • The saved search [redacted] doesn't contain dispatch.earliest_time.It is prohibited to specify scheduled searches that don't specify a dispatch.earliest_time in Splunk Cloud. File: default/savedsearches.conf Line Number: 165

    All saved searches must have an earliest time. If a search is set to All-Time in the GUI. It will normally have a latest_time of “now()” and no earliest_time defined. You can fix this by going to the $SPLUNK_HOME/etc/apps/appname/default/savedsearches.conf and adding “dispatch.earliest_time = 1” under the appropriate search stanzas. This will set the start time at the start of unix time.

    6.
    check_for_valid_package_id

    • The app.conf [package] stanza's has an invalide 'id' property: [redacted]. For the `id` property, it must contain only letters, numbers, `.` (dot), and `_` (underscore) characters, and can not endwith a dot character. Besides, some reserved names are prohibited. See https://docs.splunk.com/Documentation/Splunk/7.3.1/Admin/Appconf for details. File: default/app.conf Line Number: 6

    check_that_directory_name_matches_package_id

    • The `app.conf` [package] stanza has an `id` property that does not match the uncompressed directory's name. `app.conf` [package] id: [redacted] uncompressed directory name: [redacted]. File: default/app.conf Line Number: 6

    In the $SPLUNK_HOME/etc/apps/appname/default/app.conf there is an id property under the [package] stanza. This has to exactly match the filename of the UNCOMPRESSED app package. It can also only contain letters, numbers, dot and underscore.

    Example
    Old:
    [package]
    id = Test® Template™ BETA
    New:
    [package]
    id = TestTemplate
    You would also have to rename the directory to match the id;

    Commands
    mv TestTemplateBETA TestTemplate

    7.
    check_for_local_meta

    • Do not supply a local.meta file- put all settings in default.meta. File: metadata/local.meta

    There should be no local.meta file. If there is one and it is populated, you should merge the local.meta into the default.meta. Make sure that you aren’t making changes to the app while you are packaging it, or a new local.meta file will be created.

    Commands
    cat default.meta local.meta > merged.meta
    mv merged.meta default.meta
    chmod 600 default.meta

    8.
    check_indexes_conf_properties

    • In stanza [redact]_initial_index, property coldPath should be $SPLUNK_DB/somedata_index/colddb, but is $SPLUNK_DBsomedata_indexcolddb here. File: default/indexes.conf Line Number: 3
    • Illegal property maxTotalDataSizeMB found in stanza somedata_index. Only properties [homePath, coldPath, thawedPath, frozenTimePeriodInSecs, disabled, datatype, repFactor] are allowed in default/indexes.conf. File: default/indexes.conf Line Number: 15

    The file indexes.conf must have certain properties and must be written with forward slashes (/).

    Example
    Old:
    [somedata_index]
    coldPath = $SPLUNK_DBsomedata_indexcolddb
    enableDataIntegrityControl = 0
    enableTsidxReduction = 0
    homePath = $SPLUNK_DBsomedata_indexdb
    maxTotalDataSizeMB = 512000
    thawedPath = $SPLUNK_DBsomedata_indexthaweddb
    New:
    [somedata_index]
    coldPath = $SPLUNK_DB/somedata_index /colddb
    homePath = $SPLUNK_DB/ omedata_index /db
    thawedPath = $SPLUNK_DB/somedata_index /thaweddb

    9.
    check_for_sched_saved_searches_latest_time

    • The saved search [redacted] doesn't contain dispatch.latest_time.It is better to add a dispatch.latest_time when specifying scheduled searches in Splunk Cloud. File: default/savedsearches.conf Line Number: 165

    All saved searches should have a latest time. If a search is set to All-Time in the GUI. You can fix this by going to the $SPLUNK_HOME/etc/apps/appname/default/savedsearches.conf and adding “dispatch.latest_time = now()” (or whatever appropriate time frame) under the appropriate search stanzas.

    10.
    check_kos_are_accessible

    • In Splunk Cloud, customers have access to the sc_admin role instead of the admin role. Your customers will not be able to access knowledge objects where the only assigned role is admin. Please consider also including the sc_admin role for compatibility with Splunk Cloud. File: local.meta Line Number: 342

    To fix this you must go into the appropriate file (default.meta in this case) and replace all instances of “admin” to “sc_admin” for the Splunk Cloud users.

    Commands
    cd $SPLUNK_HOME/etc/apps/appname/medata
    vi default.meta
    :%s/admin/sc_admin
    :wq

    11.
    Check_that_extracted_splunk_app_does_not_contain_prohibited_directories_or_files

    • A prohibited file or directory was found in the extracted Splunk App: default/data/ui/views/._[redacted].xml

    NOTE: On a MacOS machine, there are temporary files created that will be denied by the cloud vetting process. To avoid this, a variable to not copy the temporary files (dot_underscore) must be set followed by the appropriate flag in the tar command.

    Commands
    export COPYFILE_DISABLE=1
    tar –exclude=”.*” -czvf appname.tar appname

    Learn how TekStream can guide you through the complexities of business and digital transformation by getting in touch with us today.