Category: Splunk

  • How to Get CrowdStrike Data Into Splunk: A Step-by-Step Guide

    How to Get CrowdStrike Data Into Splunk: A Step-by-Step Guide

    By Dave Cheever, Splunk Consultant

    This blog will take you through the necessary steps to get CrowdStrike data into Splunk via API. Before starting, ensure the CrowdStrike App and Technical Add-On (TA) are installed in your Splunk environment. For Splunk Cloud, simply install both the App and TA using your Search Head. For on-prem instances, the CrowdStrike App should be installed on Search Heads and the TA should be installed on Indexers or Heavy Forwarders depending on where your data will be collected and parsed. Don’t forget to also create an index for your new CrowdStrike data.

    Phase One: Generate an API key in CrowdStrike

    Navigate to SUPPORT AND RESOURCES within the Falcon console to manage API clients and keys used by your organization. Select API CLIENTS AND KEYS to view, edit, or create an API:

    CrowdStrike console sidebar with “Support and resources” expanded and “API clients and keys” highlighted in red, indicating where to initiate API setup.

    Your account’s cloud base URL for API interactions is located on the top of this page. Select ADD NEW API CLIENT to generate a new API:

    The API Clients and Keys dashboard in CrowdStrike, showing a list of OAuth2 API clients with a red arrow pointing to the Base URL and a button to add a new API client.

    Provide an API client name, a description for this API, and select your API scopes. At a minimum, you’ll want to select EVENT STREAMS as seen below:

    Add new API client form in CrowdStrike, showing fields for client name, description, and selectable API scopes such as “Event streams.”

    Record your API secret somewhere safe. Once this window is closed, the secret is no longer available. This information will be used when configuring the TA within Splunk:

    Confirmation screen showing newly created API credentials in CrowdStrike including client ID, secret, and base URL with a reminder to copy credentials.

    Phase Two: Configure the CrowdStrike TA in Splunk

    In the CrowdStrike Falcon Event Streams TA, select CONFIGURATION toward the top of the page. Within the Account tab, click ADD and enter the details below:

    • Account Name: This can be whatever you want as it is only used in context of this TA.
    • Username: Client ID from the API client generated above.
    • Password: Secret from the API client generated above.

    Splunk Add Account dialog box where the CrowdStrike API client credentials are entered including account name, username, and password.

    Next, go to INPUTS on the top of the page and select CREATE NEW INPUT. Enter the required information as seen below. Note that the API Credential dropdown will now have your CrowdStrike account created in the last step:

     Splunk configuration screen for adding CrowdStrike Event Streams input with fields for name, interval, index, API credential, and application ID.

    Once saved, you will see your new input has been created. It may take several minutes for events to start coming into your CrowdStrike index (i.e., index=crowdstrike). The CrowdStrike Falcon app will also start populating as data comes in. The home view defaults to the last 24 hours, so you may need to expand your time range to make the dashboard populate.

     Splunk dashboard showing CrowdStrike detections and events, with tile visualizations for total events, detection counts by status, severity breakdown and trends.

    If you have additional questions regarding configuration of the CrowdStrike app or onboarding of data, reach out to our team here at TekStream.

    We look forward to hearing from you!

  • Securing Splunk 9.0

    Securing Splunk 9.0

    Implementing Splunk Web SSL and TLS Hostname Certificate Validation

    This post focuses on how to secure Splunk Enterprise 9.0 deployments by implementing SSL for Splunk Web and configuring TLS certificate hostname validation. It focuses securing a simple deployment consisting of a single all-in-one Splunk instance (i.e.., responsible for indexing, searching, app and configuration deployment) and a solitary universal forwarder. Figure 1 below shows a diagram of the deployment used in this blog post.

    Black lock icon on a transparent background, symbolizing secure access and encryption in Splunk configurations.

    Figure 1. Splunk Enterprise 9.0 deployment consisting of a single all-in-one instance (aio1) and a single universal forwarder (uf1)

    The all-in-one Splunk instance (aio1) runs Splunk Enterprise version 9.0.2, and the universal forwarder runs Splunk Universal Forwarder 9.0.2. The operating system running on aio1 and uf1 is CentOS Stream release 8.

    NOTE:

    • To follow along with this blog post, you will need to obtain a copy of the public certificate of your organization’s Certificate Authority (CA) and the ability to either generate a public certificate or submit a certificate signing request (CSR) for your Splunk Enterprise servers and universal forwarders.

    • It is assumed that you have backend access to your deployment (e.g., able to SSH into your hosts) and can execute Splunk management commands.

    • The SPLUNK_HOME environment variable refers to the Splunk installation directory and may be different in your set up. For this blog series, SPLUNK_HOME will be set to:

    /opt/splunk (aio1)

    /opt/splunkforwarder (uf1)

    • It is important to use the OpenSSL version shipped with Splunk Enterprise to avoid compatibility issues that may present themselves when using a non-Splunk OpenSSL version to generate private keys and public certificate requests. The version OpenSSL provided by Splunk can be accessed in the CLI using $SPLUNK_HOME/bin/splunk cmd openssl.

    Preparing the Deployment and Gathering TLS Certificates

    This section will focus on the configuring the Splunk Enterprise all-in-one instance aio1. The steps described in this section can be replicated on any Splunk instance and universal forwarder.

    In this set up, we will need to create the folders and apps to hold our configurations. Create a directory called org_certs/ in the $SPLUNK_HOME/etc/auth directory to hold the TLS certificates used to secure connections.

    Next, create the following folders within the newly created $SPLUNK_HOME/etc/auth/org_certs/ folder:

    • root/ – will hold the public certificate of the Certificate Authority responsible for issuing certificates
    • server/ – will hold the private key generated by and public certificate issued to the Splunk instance

    Terminal command sequence showing the creation of a new certificate directory under $SPLUNK_HOME/etc/auth/org_certs for organizing Splunk TLS/SSL certificates.

    Figure 2. Creating folders to hold CA public certificate and certificate issued to the server

    Next, place a copy of the CA’s public certificate in $SPLUNK_HOME/etc/auth/org_certs/root. The name of the certificate file does not have to match the name in Figure 3 and can be anything you chose that describes its purpose. Ensure that the following with the CA public certificate is true:

    • Account that Splunk is running as has ownership of the file
    • CA public certificate is in PEM (.pem) format.

    Command-line output listing a CA certificate (ca.pem) located in the root subdirectory of the org_certs folder, a critical step in the Splunk SSL setup process.

    Figure 3. CA public certificate

    Generating Private Keys

    Navigate to $SPLUNK_HOME/etc/auth/org_certs/server and generate a RSA private key for the Splunk instance. When prompted, supply a password.

    Terminal view showing the generation of a 2048-bit RSA private key (aio1.key) using OpenSSL, including a prompt to set a passphrase.

    Figure 4. Generating RSA private key for Splunk instance

    Remove the password from the generated private key file using the command in Figure 5. The reason for removing password protection from the private key file is that Splunk performance may degrade due to handshake operations timing out when having to decrypt the private key. The impact of this is typically felt with Splunk Web timing out and producing 500 Internal Server errors.

    Terminal command to convert a key file and output the RSA private key contents using OpenSSL, illustrating key management for Splunk SSL security.

    Figure 5. Remove password from generated private key file

    Generating and Submitting a Certificate Signing Request (CSR)

    For TLS certificate hostname validation to work properly, we will need to make sure that the common name (CN) of the public certificate obtained from the CA matches the actual hostname of the server and that any possible subject alternative names (SAN) are identified, e.g., if the hostname is aio1, a possible SAN would be aio1.example.com. To do this, create a custom SSL configuration file in $SPLUNK_HOME/etc/auth/server called cert.cnf and add the following content to it:

    [req]
    distinguished_name = req_distinguished_name
    req_extensions = req_ext
    prompt = no
    
    [req_distinguished_name]
    # Replace the below with your organization's information
    C = US
    ST = Georgia
    L = Atlanta
    O = Tekstream   
    OU = Splunk
    
    # Replace with the server's hostname
    CN = aio1
    
    [req_ext]
    subjectAltName = @alt_names
    
    [alt_names]
    # Replace with IP.2 with your server’s address.
    # IP.1 is set to the loopback address in order to run Splunk CLI commands on the server
    IP.1 = 127.0.0.1
    # You can add the server IP address, e.g. IP.2 = 10.1.2.3
    # Add any alternative names that the server is known by, e.g. DNS.1 = aio1.example.com  
    

    Next, save the configuration file and run the following command to generate the CSR to submit to the CA:

    $SPLUNK_HOME/bin/splunk cmd openssl req -new -key server.key -config cert.cnf -out server.csr

    (Optional) Check the content of the CSR you just created by running the following command to see the CN and SANs configured in the request:

    Terminal output of a certificate signing request (CSR) showing details like Subject DN and signature algorithm, used for setting up a secure Splunk instance.

    Figure 6. Output of Certificate Signing Request (CSR) for all-in-one Splunk instance

    Finally, submit the CSR to your CA and wait for the CA to issue a public certificate for the instance. When you receive the server’s public certificate, store it in $SPLUNK_HOME/etc/auth/org_certs/server and ensure that the account Splunk is running as has ownership and the ability to read the certificate file.

    (Optional) Verify that the Subject Alternative Names show up in the server’s public certificate by running the following command, replacing the name of the certificate file with your own:

    [splunk@aio1 server]$ splunk cmd openssl x509 -in server.pem -noout -text | grep -A 1 “Subject Alternative Name”

    You should see an output similar to below:

    X509v3 Subject Alternative Name:
    	IP Address:127.0.0.1
    

    Preparing the Public Certificate for the Splunk Instance

    Once you receive the CA-issued public certificate, place it in the $SPLUNK_HOME/etc/auth/org_certs/server folder and ensure that Splunk can read the certificate file and that it is in PEM format. If the issued certificate is not in PEM format, you can perform one of the following commands based on the file extension to convert it to PEM.

    To convert a certificate from CRT to PEM:

    [splunk@aio1 server]$ $SPLUNK_HOME/bin/splunk cmd openssl x509 -in server.crt -out server.pem

    To convert a certificate from DER to PEM:

    [splunk@aio1 server]$ $SPLUNK_HOME/bin/splunk cmd openssl x509 -in server.der -out server.pem

    To convert a certificate from PKCS7 to PEM:

    [splunk@aio1 server]$ openssl pkcs7 -print_certs -in certificate.p7b -out certificate.cer

    To convert a certificate from PKCS12 to PEM:

    [splunk@aio1 server]$ $SPLUNK_HOME/bin/splunk cmd openssl pkcs12 -in server.p12 -out server.pem -clcerts -nokeys

    With the server’s public certificate in PEM format, our next step will be to combine the server public certificate, the CA public certificate, and the server private key into a single PEM certificate file. Make sure you are within the $SPLUNK_HOME/etc/auth/org_certs/server directory and run the following to combine the certificate files:

    [splunk@aio1 ~]$ cd /opt/splunk/etc/auth/org_certs/server/
    [splunk@aio1 server]$ cat server.pem server.key ../root/ca.pem > server-combined.pem
    

    The contents of the combined certificate file should look similar to what is below:

    ----- BEGIN CERTIFICATE -----
    … (server public certificate) …	
    ----- END CERTIFICATE -----
    ----- BEGIN RSA PRIVATE KEY -----
    … (server private key) …
    ----- END RSA PRIVATE KEY -----
    ----- BEGIN CERTIFICATE -----
    … (CA public certificate) …
    ----- END CERTIFICATE -----
    

    (Optional) Verify the information within the combined public certificate PEM file matches the original server public certificate PEM file by running the following:

    # Create a temporary file containing the certificate info of the original certificate
    [splunk@aio1 server]$ $SPLUNK_HOME/bin/splunk openssl x509 -in server.pem -text -noout > pemfile1
    
    # Create a second temporary file containing the certificate info of the combined certificate
    [splunk@aio1 server]$ $SPLUNK_HOME/bin/splunk openssl x509 -in server-combined.pem -text -noout > pemfile2
    
    # Compare the two files to see if the are different:
    #	- If no output is generated, the certificates match and we can proceed
    #	- If there is output, you will need to recreate the combined certificate file
    [splunk@aio1 server]$ diff pemfile1 pemfile2
    [splunk@aio1 server]$
    

    Before continuing, repeat the steps above for your universal forwarders to obtain the required certificate files. Make sure to provide the correct hostname for the universal forwarder when generating the CSR.

    Securing Splunk with TLS Certificates

    Before proceeding with the set up of SSL for Splunk Web and TLS certificate hostname validation, we will need to create three configuration apps, org_enable_splunkweb_ssl, org_enable_tls_validation, and org_indexer_base, within $SPLUNK_HOME/etc/apps on the Splunk server (aio1).

    Create the configuration app folders and ensure they have the following directory structure:

    Directory structure of multiple Splunk apps (e.g., org_enable_splunkweb_ssl and org_enable_tls_validation) showing local config files like web.conf and server.conf for SSL/TLS enablement.

    Figure 7.Configuration app directory structures

    For each app’s local/app.conf file, add the following content:

    [install]
    state = enabled
    
    [package]
    check_for_updates = false
    
    [ui]
    is_visible = false
    is_manageable = false
    
    Next, for each app’s metadata/local.meta file, add the following content:
    
    []
    access = read : [ * ], write : [ admin ]
    export = system
    

    Configure SSL for Splunk Web, TLS Certificate Hostname Validation, and Receiving on the All-in-One Instance

    Navigate to the local folder of the configuration app we created earlier to enable SSL for Splunk Web, $SPLUNK_HOME/etc/apps/org_enable_splunkweb_ssl/local. Add the following content to the web.conf file:

    [settings]
    # Enable SSL for Splunk Web
    enableSplunkWebSSL = true
    
    # Reference the server’s private key created earlier.
    privKeyPath = $SPLUNK_HOME/etc/auth/org_certs/server/server.key
    
    # Reference the server’s public key obtained from your CA
    serverCert = $SPLUNK_HOME/etc/auth/org_certs/server/server-combined.pem
    
    Next, navigate to the local folder of configuration app to enable TLS hostname validation, $SPLUNK_HOME/etc/apps/org_enable_tls_validation/local. Add the following content to the server.conf file:
    
    [sslConfig]
    # Reference the file that contains all root certificate authority certificates combined
    sslRootCAPath = $SPLUNK_HOME/etc/auth/org_certs/root/ca.pem
    
    # Turns on TLS certificate requirements
    sslVerifyServerCert = true
    
    # Turns on TLS certificate host name validation
    sslVerifyServerName = true
    serverCert = $SPLUNK_HOME/etc/auth/org_certs/server/server-combined.pem
    
    # Turns on TLS certificate hostname validation for CLI. This is a required setting on
    # any instance you will use the CLI to connect to a Splunk platform instance. E.g.,
    # running ‘splunk reload deploy-server’ to deploy app bundles from a Deployment Server
    # to Deployment Clients.
    cliVerifyServerName = true
    

    Next, navigate to the local folder of the configuration app to enable receiving on the server, $SPLUNK_HOME/etc/apps/org_indexer_base/local. Add the following content to the inputs.conf file:

    # Enable listening on port 9996 for receiving events using SSL
    [splunktcp-ssl://9996]
    
    # Configure SSL settings
    [SSL]
    # Full path to the combined server certificate file.
    serverCert = $SPLUNK_HOME/etc/auth/org_certs/server/server-combined.pem
    
    # Force client to present an SSL certificate to authenticate
    requireClientCert = true
    
    # TLS/SSL version required for handshakes to be successful. 
    # It is best practice to use the latest version of TLS, which is version 1.2 at the time of this writing.
    sslVersions = tls1.2
    
    # Comma-separated list of Common Name (CN)
    sslCommonNameToCheck = uf1
    
    # Optional, if Subject Alternative Names (SAN) are configured in client certificates
    # sslAltNameToCheck = uf1.example.com
    

    Restart Splunk on the server and verify whether you can log into Splunk Web. If you are unable to log in, check internal splunkd logs and revisit the steps outlined in this blog.

    Configure Secure Forwarding on Universal Forwarder

    Before continuing, make sure that the universal forwarder (uf1) has a private key, a public certificate, and the CA public certificate in $SPLUNK_HOME/etc/auth/org_certs, in the respective server/ and root/ folders.

    On the universal forwarder, create a configuration app in the $SPLUNK_HOME/etc/apps folder called org_forwarder_outputs. The configuration app should have a similar directory structure as the apps we created earlier, with the only difference being configuration files within:

    Directory tree of the org_forwarder_outputs Splunk app, showing outputs.conf and related configuration files for securely forwarding data.

    Figure 8. Configuration app directory structure

    Navigate to $SPLUNK_HOME/etc/apps/org_forwarder_outputs/local and add the following content to the server.conf file:

    [sslConfig]
    sslRootCAPath = $SPLUNK_HOME/etc/auth/org_certs/root/ca.pem

    Next, add the following content to the outputs.conf file:

    [tcpout]
    defaultGroup = primary_indexers
    
    [tcpout:primary_indexers]
    disabled = false
    # Replace <IP-Address> with IP address of the all-in-one instance
    server = <IP-Address>:9996
    
    # SSL SETTINGS
    clientCert = $SPLUNK_HOME/etc/auth/org_certs/server/server-combined.pem
    sslVerifyServerCert = true
    useClientSSLCompression = true
    sslCommonNameToCheck = aio1
    

    Finally, restart the Splunk on the universal forwarder. After Splunk restarts on the universal forwarder, you can verify that it is connecting to the all-in-one instance by checking the internal Splunk logs on the universal forwarder. You should see something like the following that will confirm communication between the two servers:

    12-08-2022 01:19:43.439 +0000 INFO  AutoLoadBalancedConnectionStrategy [1032 TcpOutEloop] - Connected to idx=x.x.x.x:9996:2, pset=0, reuse=0. autoBatch=1 

    Another way to verify that the universal forwarder is forwarding events search for its internal logs from the all-in-one instance. Run the following SPL query over the last 15 minutes to verify this:

    index=_internal host=”uf1”

    Conclusion

    There you have it. You have successfully configured TLS hostname validation between an all-in-one standalone Splunk server and universal forwarder. Let’s revisit the steps taken to achieve this goal:

    • Created a directory, $SPLUNK_HOME/etc/auth/org_certs/ to hold our certificates for the CA and our Splunk instances.
    • Prepared our certificates for configuring TLS hostname validation, making sure that the Common Name (CN) identified in each public certificate for the server matched the server’s hostname and included the loopback address as a Subject Alternative Name (SAN).
    • Created three apps on the all-in-one instance and restarted the server:
    • org_enable_splunkweb_ssl – enables SSL for Splunk Web
    • org_enable_tls_validation – configure TLS hostname validation
    • org_indexer_base – configures receiving on the all-in-one instance using our certificates
    • Created a single app on the universal forwarder and restarted it:
    • org_forwarder_outputs – tells the universal forwarder to use our certificates when sending events to the all-in-one instance
    • Verified that our configuration was successful by checking the internal logs of each server and running a query from the all-in-one instance to confirm that it was receiving events from the universal forwarder.

    For more information on TLS hostname validation, reference the following Splunk documentation: https://docs.splunk.com/Documentation/Splunk/9.0.2/Security/EnableTLSCertHostnameValidation

  • Using Rsyslog with Splunk

    Using Rsyslog with Splunk

    By Dave Cheever, Splunk Consultant

    While Splunk can receive syslog events directly, having a centralized logging location is considered best practice. There are inherent issues that come with sending data to syslog over UDP 514. First, UDP is a stateless protocol that does not guarantee delivery which can result in events getting dropped. When you restart Splunk the listener is not available, thus you will lose events while Splunk is down. Additionally, it is difficult to differentiate between the various datasets coming in. If all syslog data sources are coming into Splunk as “udp:514” or “syslog”, how can you easily distinguish the events you are analyzing? Rsyslog is a great way to integrate log aggregation while also addressing these concerns.

    Modular Approach

    Rsyslog allows for a modular approach by treating messages according to defined rules. For example, data sources can be sent to different ports allowing them to be separated into their own respective directories. This can then be utilized in the Universal Forwarder’s monitor input to collect the logs and send them to Splunk. With this method, your data flow will resemble the following and Splunk will now be able to segregate source types:

    Use Rsyslog to segregate source types and forward to Splunk.
    Sample Rsyslog workflow

    When rsyslog is installed, the main configuration file is located under /etc/rsyslog.conf. In there you will find that $ModLoad imtcp is commented out. This needs to be uncommented to allow for TCP syslog reception (also uncomment $ModLoad imudp if you’ll be using UDP). There are three key components within rsyslog.conf to specify data collection ports and store messages in separate directories:

    1. Inputs objects designate input sources to collect the messages. For this use case, you’ll want to be familiar with the imptcp input module mentioned above. This module provides the ability to receive syslog messages via TCP and allows for specifying which ports to send data to. Ideally, each technology will be collected on its own unique port.
    2. Filter conditions allow for property-based or expression-based filtering. This will check messages against specific conditions using a compare operation. All remote traffic coming in will pass through technology-specific filters to match against the corresponding data sources.
    3. Rulesets specify how rsyslog will process a message when the filter condition is true. Rules provide the ability to carry out specific actions such as write a message to disk or send to a remote location. In this case, the output should be written to a directory to be used in the root of the UF monitoring stanza.

    Once messages are written to a local directory on the syslog server, the Universal Forwarder can now transmit this data to Splunk. The UF’s inputs configuration file will allow the events to be collected, and will also allow for setting the indexes, source types, and host segments of the data. Assigning the source type will help distinguish data sources as well as determine how event data will be formatted during the indexing process; be sure to use what is required by the respective TA. The inputs.conf stanzas should resemble something like this:

    [monitor:///<log root>/<vendor name>/*/*.log]
    index=foo
    sourcetype=bar
    host_segment=<the segment in the path that is your hostname>
    

    There you have it! We hope this has answered your questions about Rsyslog. Please contact us if you would like further information.

  • Slice And Dice: Comparing Values Over Specific Times With Splunk Dashboards — Part Two

    Slice And Dice: Comparing Values Over Specific Times With Splunk Dashboards — Part Two

    By Marvin Martinez, Team Lead – Security Operations

    Part Two: Isolate and Compare

    Welcome back to our series discussing some unique ways to visualize data across specific points in time with Splunk SPL! In Part One, we created a dashboard chart to show day over week values over multiple weeks. In this segment, we will expand on our previous chart and isolate and compare one day from a specific week to the same day from the current week and show the percentage change between the two values across the day in a new area chart visualization.

    Using our sales example from our first installment (shown below), we showed a full day across 4 weeks, overlaid in one line chart visualization. Now, what if, after analyzing this at a high level, you wanted to display percentage changes between the latest Thursday (red line) and the Thursday 3 weeks back (blue line)?

    Time series comparison graph in Splunk displaying multiple Thursdays across different weeks, labeled by date and color-coded to show trends over a single day.

    Once we’re done, our visualization will look as shown below. In the image below, a dropdown input is populated with the options for the last 3 weeks and is passing a value of 1-3 to send as a token to the panel search in order to determine which week to compare with the day from the current week. The panel itself consists of an area chart visualization that will be formatted with the week values as chart overlays to highlight the percentage change.

    Splunk dashboard chart showing percentage change between Current Week and Compared Week using an area overlay and dual-axis line graph.

    Since the search is a little extensive and consists of various parts, let’s view the complete search first and then break it down to its various steps to make it easier to digest. This is the search that was used for the panel above. The field being used for the chart is the TotalSales field.

    index=test …
    | eval Date = strftime(_time,"%m/%d"), Day = strftime(_time,"%A"), Hour=strftime(_time,"%H"), TotalSales = round(TotalSales,2)
    | fields  _time, "TotalSales", Hour, Day, Date
    | where Day = "Thursday"
    | sort 0 - _time
    | streamstats dc(Date) as WeekNum current=true
    | eval WeekNum = WeekNum - 1
    | where WeekNum = 0 OR WeekNum = 3
    | stats values(LatestWeek) as CurrentWeek, values(PriorWeek) as PriorWeek, values(eval(if(WeekNum=0,Date,NULL()))) AS Date by Hour
    | eval CurrentWeek = IF(ISNULL(Date),"",CurrentWeek), Delta_Percentage = round(((CurrentWeek - PriorWeek)/PriorWeek) * 100,2)
    | eval xAxis = "Hour (" . Date . ")"
    | eval {xAxis} = Hour
    | rename CurrentWeek AS "Current Week", PriorWeek as "Compared Week", Delta_Percentage AS "% Change"
    | fields "Hour *" "% Change" "Current Week" "Compared Week"
    
    

    Let’s break this search down and explain what is going on here. The first 4 lines are setting up our data. We create fields to store the specific Date, Day, and Hour for our values as well as filter out only the information for the specific day we are looking to compare. In this case, Thursday is the selected day but this could easily be replaced with a token here to allow dynamic selection of any day of the week.

    | sort 0 - _time
    | streamstats dc(Date) as WeekNum current=true
    | eval WeekNum = WeekNum - 1
    | where WeekNum = 0 OR WeekNum = 3

    These next 4 lines of the search allow us to filter for the day of the current week and the day of the selected week. A quick way to do that here is to sort the result set in descending date order, then running a streamstats command to get the distinct number of weeks. Using this strategy, it makes it much easier to be able to configure a dropdown input to easily allow someone to simply select any previous week with just a number. In this case, the where command is filtering for WeekNum = 0 or WeekNum = 3, which will isolate only the values for the Thursday of the current week or the Thursday 3 weeks back. This “3” value is where you could instead use a token from a dropdown to allow for dynamic selection of different weeks back. At this point, we have now isolated our result set to solely the two days we are looking to compare.

    | stats values(LatestWeek) as CurrentWeek, values(PriorWeek) as PriorWeek, values(eval(if(WeekNum=0,Date,NULL()))) AS Date by Hour
    | eval CurrentWeek = IF(ISNULL(Date),"",CurrentWeek), Delta_Percentage = round(((CurrentWeek - PriorWeek)/PriorWeek) * 100,2)

    Now that we have isolated our data, we can use stats to perform our aggregation and group our values according to each hour of the day into their own separate fields. Since our result set is now only from the current week and the selected week in the past then, logically, the “latest” value will be from the current week and the “earliest” value will be from the previous, selected week. We group these by Hour of the day and each event will now have the value for each hour from both days. Crucially, this is what we need in order to be able to calculate the percentage delta between periods. Note that the Date field is pulled so we can have the latest date reflected in our x-axis for reference, as we’ll see later. The following eval command nulls out any CurrentWeek values when the Date field is also null to avoid any issues with the charting if Date values are null but those CurrentWeek values are not. Additionally, we calculate the Delta_Percentage between the two values.

    At this point, if you ran the search up to our latest command, your results should return a table with the Hour of the day, a CurrentWeek and PreviousWeek value for each of the days being compared, the date of the day of the current week, and the delta percentage between the day from the current week and the week being compared.

    Tabular view in Splunk displaying hour-by-hour comparison between CurrentWeek and PriorWeek values with calculated delta percentage changes.

    Now, all that remains is to get all the fields named in a more presentable fashion before we prepare our chart. That’s what the last 4 lines in our SPL achieve.

    | eval xAxis = "Hour (" . Date . ")"
    | eval {xAxis} = Hour
    | rename CurrentWeek AS "Current Week", PriorWeek as "Compared Week", Delta_Percentage AS "% Change"
    | fields "Hour *" "% Change" "Current Week" "Compared Week"

    The first line above assigns a field (xAxis) with the string “Hour” followed by the date of the “current day” being compared in parentheses. In this example, that text will read “Hour (12/16)”. Then, in the second line, that text is used to create a field by that name (the field label in braces) and is assigned the value of the Hour. In the last two lines, we just rename our fields to be more presentable and then leave only the Hour (using the “Hour *” wildcard to allow for the date in the field label), % Change, Current Week and Compared Week.

    Finally, we can configure our visualization! Format the panel/visualization as an area chart. Assign Current Week and Compared Week as Chart Overlay fields and set them to be on their own axis.

    Full view of Splunk’s Chart Overlay configuration panel, highlighting overlay selection, axis toggles, and optional settings like interval, min/max values, and scale.

    This will show the two values as lines on the chart and leave the % Change field as the shaded area between them to help visualize the percentage difference between the Thursday this week and the Thursday 3 weeks ago, across every hour of the day. Until next time!

    Repeated Splunk dashboard showing percentage change area chart comparing 3 weeks back with the current week on a 24-hour time axis.

    Stay tuned for our next installment in this series on unique Splunk Dashboard panels, when we will discuss how to pick one single value from the day (i.e. a specific hour value) and plot it back across the same hour and day from previous weeks in one line! A sample image is shown below.

    Line chart comparing metrics from the past four weeks and current week, plotting values over time using a “WeeksBefore” x-axis label and highlighting trends across dates.

    Contact Marvin below to ask questions or share ideas. Happy Splunking!

  • Four Signs Your Splunk-Centric Managed Detection and Response (MDR) Solution is Falling Short

    Four Signs Your Splunk-Centric Managed Detection and Response (MDR) Solution is Falling Short

    by Bruce Johnson, Senior Director, Enterprise Security

    Gartner estimates that by 2025, the MDR market will reach $2.15 billion in revenue, up from $1.03 billion in 2021, for a compound annual growth rate (CAGR) of 20.2% (Source: Gartner Market Guide for Managed Detection and Response Services, Shoard, Lawson, et. al., Gartner Report ID G00734630, October 25, 2021). More companies are investing in a managed detection and response (MDR) solution to help improve their security posture. With this growth, we are seeing clients fall into a false sense of security because they don’t know what they aren’t seeing, and they don’t realize that it could be so much better.

    In this blog, we share learnings from the TekStream MSSP & MDR team, who give you four signs that your MDR solution may be lacking and outline ways you can solve this security problem. But first, how do you know what you’re missing?

    Is your MDR provider giving you full protection?

    As the leaders in implementing Splunk managed detection and response security solutions, the TekStream MDR team sees many customer environments not set up to get the leverage out of Splunk they were expecting. Often, they are relying on solutions that don’t ingest security data appropriately or lack the Splunk seniority to resolve onboarding issues. As a result, decisions made by the SOC (Security Operations Center) from partial views of the security threat surface are distorted, inaccurate, and lack fidelity. It’s what we know as “garbage in, garbage out.”

    Are you paying for your MDR Solution twice?

    We have helped other customers that were stuck with proprietary solutions using non-Splunk bolt-on applications owned by another implementation company. The old setup limited the rich features the Splunk platform offers, and they weren’t getting a return on their investment, not to mention their own data is owned by someone else. Many MDR solutions leveraging Splunk were conceived of several years ago and Splunk was relegated to a passive data store, never taking advantage of it as an enterprise security solution. The net result is that they end up paying for a SIEM solution twice, one Splunk based and the other proprietary.

    Do these questions haunt you?

    • Am I getting the Splunk capabilities I paid for?
    • Are there real threats to my system that I miss because of unclear or missing alerts?
    • Am I seeing everything I need to be seeing?
    • How do I find the expertise I need – when I need it?
    • Could I be paying for my SIEM solution twice?

    If you’ve invested in Splunk to power your MDR, but still worry whether you are getting the security and ROI you expect, here are the four (4) signs to identify potential shortcomings.

    Four Signs Your Splunk-Centric MDR Solution is Falling Short

    1. You’re Not Getting the Visibility You Need

    One of the most significant benefits of an MDR solution is the visibility it can provide into your organization’s security posture. This is all about how threats are surfaced, scored, and responded to.

    If your MDR solution doesn’t provide the level of visibility you need, you may have these issues:

    • You’re constantly chasing down alerts.
    • There is a lack of enrichment to the alerts from various tiers and security appliances (I.e., simple alert echoing).
    • Emerging threats don’t reveal themselves.
    • You’re not receiving the information you need to make decisions or respond to threats.

    To get the most out of your MDR solution, you must ensure you have visibility into all aspects of your environment, including your network, servers, applications, and data. Without this visibility, you won’t be able to detect and respond to threats effectively. You also need to ensure your solution protects all aspects of your environment, including your network, servers, applications, and data.

    We often see situations where an MDR solution fails to be truly embedded across an organization’s teams, business processes, response workflows and collaboration. Are there gaps in your coverage? Do modifications to correct ingestion or alerting functionality lag? Without the ability to see all corners of your system, faults can pop up without notice, and without clear definition. If you can’t tell what an alert means and your MDR solution doesn’t show you why, then you don’t have everything you need.

    2. Fidelity – data accuracy – is lacking

    While visibility is what you can see, fidelity is how accurately you see it. In other words, are the threats detected relevant? The last thing you want is a poorly implemented MDR that lets you know about minor threats as often, or more often than, more significant threats. We call this alert fatigue, and it occurs when a system lets you know about threats you don’t need to worry about. It can cause you to miss the important threats in the noise. It’s important to implement a system that reduces esoteric alerts and avoids false positives and false negatives to deliver full protection from online threats.

    3. You’re Not Able to Respond to Security Threats at The Speed You Need

    A successful MDR solution empowers your team with the data and insights they need to respond quickly and effectively to threats. The ideal MDR setup also helps you proactively identify and address potential threats before they become serious issues.

    Even better, a robust MDR solution will provide your team with automation tools that span everything from manual detection to fully automated prevention. To improve the return on your MDR investment, implement workflows and rules that prevent as many threats as possible from becoming an issue while still providing your team with the insights they need to respond manually to threats as they arrive.

    4. You’re Not Getting Expert Support

    One of the most significant issues our MDR team encounters is companies who do not have consistent access to experienced Splunk MDR talent and don’t have proper guidance for challenging technical issues. In fact, 68% of companies report that talent shortages directly led to the failure of one or more security projects/initiatives (Source: Splunk 2022 State of Security Report). Attracting expert talent is often difficult because skilled Splunk MDR experts can be expensive to hire and retain.  

    From the very outset, faulty onboarding and implementation results in a security system that isn’t incorporating the security data appropriately. When the wrong data goes into the system, then the reports and alerts you receive will be garbage. This results in decisions that are distorted, inaccurate, and lacking fidelity.

    Best Technology. Best Partner. Best Solution.

    If you’re not getting the visibility, coverage, accuracy or response you need from your MDR solution, then it may be falling short. But there’s no need to panic.

    Here at TekStream, we’re the leader in Splunk MDR implementations. We offer a full scale of services from implementation to fully managed SOC to outsourced MDR. We have a proven track record of getting companies the full power, security, and ROI out of Splunk as quickly as possible. We typically take companies like LendingPoint and FedEx from signing to kick off in two to four weeks.

    TekStream has a 100% onshore/domestic team available 24 hours a day, 7 days a week, 365 days a year. The MSSP & MDR team has the knowledge and expertise to help keep your organization safe, averaging 5+ years of experience from each developer.

    Learn more about TekStream’s MDR capabilities and schedule a free consultation today:

  • Splunk Walklex Command

    Splunk Walklex Command

    By Jay Young | Senior Splunk Consultant

    Walklex Command:

    You can use walklex to view the contents of the .tsidx files in the WebUI and the Command Line Interface. It is a generating command that shows the contents listed in warm and cold buckets. The walklex command only works on buckets that have merged a .tsidx file; this is why it is not supported for hot buckets.

    Uses: 

    The WalkLex command returns terms and location references in a tsidx file. Its uses include helping discover frequently used terms; this can be leveraged to speed up searching with the | tstats command.

    Example: Location References and Terms

    Roles:

    1. User role must have run_walklex or admin_all_objects capability.
    2. Can be executed from the command line interface on a single warm or cold bucket.
    3. Users with search filters applied to their roles cannot use walklex

    What is the .tsidx File:

    1. Time-series index file or referred to as an index file occasionally.
    2. It associates specific keywords in event data with location references (number).
    3. The .tsidx file links with a companion rawdata file.
    4. Every Splunk Search scans for search keywords in the tsidx file.
    5. The search then uses location references from the keywords to get events from the rawdata file.
    6. Creates individual .tsidx files for data models.

    WalkLex Command-line Interface (CLI) Example:

    How to utilize the WalkLex command in the CLI; this allows for a specific warm or cold bucket inspection.

    1. cd /opt/splunk/var/lib/splunk/_internaldb/db/
    2. /opt/splunk/bin/splunk cmd walklex “/opt/splunk/var/lib/splunk/_internaldb/db/bucket name/add_name_of.tsidx” “”

    Example of the WalkLex Command: /opt/splunk/bin/splunk cmd walklex “/opt/splunk/var/lib/splunk/_internaldb/db/DIR/FILESNAME.tsidx” “*”

    CLI Output Example:

    Screenshot of terminal output displaying indexed log file paths and sourcetypes from Splunk's file system, illustrating the type of data the walklex command interacts with.
    1. Add > filename.txt to the end of the command to create a text file to view a text editor.
    2. The quotes at the end of the CLI command are the pattern or term you want to search for:
      Example:
      Search everything: “*”
      Search for a specific term “scr_ip”

    Using the Walklex in the WEBUI:

    You can find more about using WalkLex in the SplunkWeb GUI from the Splunk documentation.
    Splunk Documentation Ref: https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchReference/Walklex


    Example WebUI Command:
    | walklex prefix=foo type=fieldvalue index=foo | stats sum(count) by term


    The walklex command attributes:
    prefix/pattern=[term or pattern]
    type=[fieldvalue, field, term]
    index=[name]

    Example WebUI Command and Output:
    | walklex pattern=* type=fieldvalue index=_internal | stats sum(count) by term

    Splunk table listing indexed term values and their total event counts, demonstrating how walklex reveals indexed metadata patterns across fields.

    The above example uses the pattern=* attribute to show everything in the _internal index with a count of the number of occurrences in the buckets for a specific time range.

    For more information on Walklex, or to speak with Jay about any other Splunk questions, contact him here:

  • Splunk Views: How to Embed Hyperlinks in a Custom App 

    Splunk Views: How to Embed Hyperlinks in a Custom App 

    By Nate Hufnagel, Splunk Consultant

    Private apps, also known as custom apps, grant Splunk admins the ability to package custom configurations and specialized functions into a neatly organized bundle. Throughout the lifetime of a typical Splunk deployment, there may be a need to embed custom links to enrich the end user experience. This guide will walk you through how to build your own custom app and embed a hyperlink, all through the UI. Note: in practice, this will require working knowledge of XML. The code needed to get this example working has been provided.

    Directory Tree

    Before we dive into the code itself, let’s explore the bones of most apps within Splunk. Here is a diagram of the directories that Splunk expects within its applications:

    Diagram of a Splunk custom app directory structure showing folders like appserver, default, metadata, and static, with UI XML files under the default/data/ui directory.

    More in-depth info on what each directory contains can be found here: https://dev.splunk.com/enterprise/docs/developapps/createapps/appanatomy/

    These subdirectories are created automatically when a custom app is created through Splunk Web.  Select local configuration settings, navigation menus, views, and app permissions can be customized through the UI.  The navigation menu and the views are the primary attributes we’ll be modifying in this case.  The “default/data/ui” directory is where  navigation menus and views are defined in the UI, and where hyperlinks can be embedded in the XML of custom apps.  

    Screenshot of the Splunk user interface section listing configurable elements like Time ranges, Views, PDF scheduling, Navigation menus, Prebuilt panels and Bulletin messages.

    To find the code, navigate to Settings>User Interface.  From here the XML can be edited directly.  Views and Navigation menus can be filtered by app and owner. 

    CSS stylesheets and static images can be used to further customize a private app as it appears in Splunk.  Navigate to Manage App>Edit Properties>Upload Asset to upload these types of files to a particular app.

    Splunk interface showing navigation menu XML with multiple custom dashboard view entries under the chargeback app configuration.

    Splunk Default Stylesheets

    All necessary default stylesheets and files can be found using the barebones template. In this example, it’s easiest to take advantage of the default stylesheets built into Splunk.  While there are a few to choose from, this custom app references the default stylesheet “dashboard.css”. 

    Creating the App and Custom Views via Web UI

    Splunk interface showing the form for creating a new app, with fields for app name, folder name, version, author, description and asset upload options.

    To create a custom app, navigate to Apps>Manage apps>Create App.  Fill out the fields as shown in the image below (the app name can be different).  The barebones template will suffice for this example. The option to upload assets is also available upon app creation should you desire more customization.  Once finished, click “Save”

    Now that the app is created, let’s look at the default code.  Navigate to Settings>User Interface>Navigation menus.  The Navigation menus are the “tabs” that appear in the light gray bar near the top of the UI, just below the main navigation bar.  These menus can be customized in the UI to suite your apps’ particular needs.  The default navigation menus match the ones found in the Search and Reporting app:

    Splunk Enterprise interface with top navigation bar showing tabs for Search, Analytics, Datasets, Reports, Alerts and Dashboards.

    For this example, we’ll create our own custom navigation menus.  From Settings>User Interface>Navigation menus, filter the results on the custom app name and “Created in the App”

    In the Nav name column, clock into “default” and delete the default XML.  Add the block of code below to create the custom navigation menus:

    <nav search_view="search" color="#5CC05C">
      <view name="search" default="true" />
      <view name="hyperlink" default="false" />
    </nav>
    
    Splunk XML configuration screen showing basic navigation menu with two views defined — search as default and hyperlink as secondary.

    Once finished, click “Save”

    Next we’ll create a custom view in the new navigation menu we just created.  Navigate to Settings>User Interface>Views.  Select the custom app from the drop-down menu and specify “Created in the App”.  There should be no configurations present.  Click “New View”, enter a name, and copy the body of XML below into the “View” block:

    <dashboard version="1.1" stylesheet="dashboard.css">
      <label>Hyperlink</label>
      <row>
        <panel>
          <html>
            <section>
              <p>Click the hyperlink to have fun with regex: <a href="https://regex101.com/" target="_blank">More regex, please!</a></p>
            </section>
          </html>
        </panel>
      </row>
    </dashboard>
    
    
    Splunk dashboard XML editor displaying code for a panel labeled “Hyperlink” with embedded HTML containing a link to a regex resource.

    This is where we define the stylesheet for the webpage and embed the hyperlink.  You can embed any link you like using standard XML syntax within the <section> element.  Note: if your link directs users to external sites, be sure your firewall rules allow for this.  In this example, we include a short message and a link to regex101.com.

    That’s it! Navigate to the app from the App dropdown and observe the changes to the UI.

     Final Splunk dashboard page showing a message “Click the hyperlink to have fun with regex” and an active link labeled “More regex, please!”

    For more details on this Splunk change, or to speak with Nate about any other Splunk question, contact us:

  • The Nitty-Gritty of Sorting Lexicographically in Splunk

    The Nitty-Gritty of Sorting Lexicographically in Splunk

    By David Allen, Senior Splunk Consultant

    In Splunk, especially in relation to sorting, we often hear the word “lexicographical”. But what does lexicographical really mean and how does Splunk decide the lexicographical precedence that it uses? We will answer this question by taking a deep dive into the most basic building blocks of computer software – binary numbers and a decades old table used today to sort all our modern-day data analytics results. Let’s get started!

    Lexicographically is a sorting process based on UTF-8 and more specifically ASCII which is an abbreviation for American Standard Code for Information Interchange. ASCII is a character encoding method originally developed for electronic communications. ASCII codes represent text in computers, telecommunication equipment and other devices.

    The history of ASCII reaches back to the early 1960s and is based upon an 8-bit byte. Seven of the bits are used to define the symbol codes and 1 bit was used for the parity – a rather simple form of error detection not used any longer. Back in those days there was a lot of work being done to make a standard for communication from computers to other devices, namely printers, teletype machines and even punch card machines. In addition to the printable characters (upper case, lower-case, numbers and some white space characters), there are a lot of non-printable control characters designed to control certain features not used much today, i.e. the backspace and bell codes among others.

    There were a lot of revisions to the ASCII code table down through the years as the standard evolved into what we use today as the accepted ASCII standard below.

    Vintage-style USASCII code chart showing binary, decimal, and character representations for control characters, digits, punctuation and letters.
    ASCII chart from a pre-1972 printer manual

    Now, back to Splunk and the lexicographical sorting process… By sorting from the lowest bits (00000002 to the highest bits 011111112) top left to bottom right, we can now see why Splunk states the sorting precedence is as follows…

    Numbers are sorted before letters

    This is because the number 0 has an ASCII code of 001100002 and the last number 9, has a binary code of 001110012 and these codes are less than the lowest code for the letters which happens to be the capital letter A with a binary code of 010000012.

    Uppercase letters are sorted before lowercase letters

    This is because the uppercase letters all have binary codes (010000012 – letter A through 010110102 – letter Z) lower than the lowest lower-case letter (letter a) with a binary code of 011000012.

    Symbols are not standard. Some symbols are sorted before numeric values. Other symbols are sorted before or after letters

    This can be seen by noticing that there are some symbol codes which are lower than the number 0 code. Notice that 001000002 (which is the code for the space symbol) through 001011112 (which is the code for the / symbol are lower codes than the code for number 0. In the same way, there are symbol codes between the numbers and the upper-case letters as well as the upper- and lower-case letters. As a result, when you are sorting symbols along with numbers and letters there may appear to be an anomaly where the symbols are all mixed up among the letters and numbers but in fact it is all makes sense if you sort by the binary codes used in the ASCII table.

    Punctuation strings are sorted lexicographically

    You may think this does not make much sense. But by looking at the ASCII codes for the punctuation symbols it starts to become clear what is going on. Let’s look at some scrambled up symbols and characters then let’s sort them lexicographically according to the ASCII table and see what we get. Below is the SPL for this example:

    | makeresults
    | eval ASCII_Symbol=”{ O u ( 3 I A o < 1 E 5 [ I U ? a ! e . 7 }”
    | makemv delim=” “ ASCII_Symbol
    | mvexpand ASCII_Symbol
    | sort 0 ASCII_Symbol
    | stats list(ASCII_Symbol) AS ASCII_Symbol
    | nomv ASCII_Symbol

    Here is the output:

    Sample output of ASCII symbols sorted lexicographically, displaying a sequence of punctuation marks, numbers, and uppercase and lowercase vowels.

    Now by looking at these results and comparing with the ASCII table above you can see that the symbols “!”, “(“ and “.” have lower binary values than all the numbers and letters. Also, the symbols “<” and “?” have binary codes higher than the numbers but lower than the upper-case letters and so forth with the remaining symbols. Going from left to right you will see the lowest symbol code to the highest symbol code.

    Splunk pro tip advising users to use '0' for the count in sort commands to avoid truncation of large datasets, ensuring full result retrieval.

    There you have it. Splunk sorting explained at the binary level. So, the next time you hear lexicographical sorting, just think ASCII sorting! That is all it is, plain and simple.

    For more information on Splunk sorting, or to contact David or one of our other Splunk experts, contact us here:

  • Beginner’s Guide to Splunk Global Configuration Files

    Beginner’s Guide to Splunk Global Configuration Files

    By: Eric Levy | Splunk Consultant

    Splunk is an invaluable tool for data analysis and provides flexible options to configure an environment tailored to the business using it. But beyond text boxes, drop-down menus, and radio buttons in the Web environment, or executing commands on the command line – how does Splunk log and make changes? Enter configuration files.

    SPLUNK CONF FILE

    Splunk configuration files (or “conf files”) – using the .conf file extension – are a series of files that dictate almost all settings in a Splunk environment. This includes data inputs, outputs, data modification, indexes, clustering, performance tweaks, and much more. Splunk deployments can have several conf files of the same name in various directories, and “merge” via precedence rules.

    Different conf files exist in a global context and an app/user context, the latter of which typically are used for search related activities. Here we will talk about conf files used in the global context, although usage at search time will be touched upon where applicable.

    CONF FILE PRECEDENCE

    Conf files can exist in default or local directories within apps or the overall system. Generally, local settings take precedence over default settings, and it is recommended users make changes in local directories. Further ordering depends on global or app/user context. For the global context, the baseline precedence order is as follows:

    • System local directory
    • App local directory
    • App default directory
    • System default directory

    EDITING CONF FILES

    Settings within a conf file follow a header, attribute structure in separate stanzas. The header is indicated in [brackets], with attributes below them. Attributes are case sensitive, and settings may not apply if typed incorrectly. Values for attributes are not case sensitive.

    To edit them, one must have file system access. Using vi or nano via the command line or a text editor is most common. To apply new changes in Splunk after editing a conf file, save it and then restart Splunk.

    Here is some more information on some of the most common global conf files:

    INPUTS.CONF

    inputs.conf is used for specifying input data sources.

    On a forwarder or single server, inputs.conf specifies data sources used in the deployment. On an indexer, inputs.conf specifies the port that a forwarder sends data (set in outputs.conf on the forwarder). The port used to send data from one Splunk instance to the next is typically 9997. On a search head, inputs.conf ingests internal logs by default.

    The available settings in inputs.conf depend on the data source being imported. The header is always formatted as [data_type://<path>], where the data_type could be monitor input, tcp/udp (network input), scripted input, etc. The <path> is the file path, but this setting may also vary depending on the data_type.

    Attributes include setting the data source’s host, index, source, and sourcetype. Specifying the sourcetype is important for processing in props.conf. Additional settings for specifying the host are available as well. Whitelist and blacklist options allow you to filter files to import within a path. Beyond these, each data_type has its own unique settings.

    PROPS.CONF

    props.conf provides several processing settings to modify data coming into Splunk. This file can apply either at index time (global context) or at search time (app/user context).

    Sourcetypes are separated by stanza with their own list of attributes. On a forwarder, parsing is limited, but indexers and search heads can provide index-time and search-time parsing.

    The “Big 8” settings, as recommended by Splunk Education, are as follows:

    • LINE_BREAKER = (regex): Determines the start of a new line.
    • SHOULD_LINEMERGE = (TRUE/FALSE): Typically set to false when used with single lined events, and not very efficient, but tries to clean up event boundaries.
    • TRUNCATE = (integer): Specifies the maximum line length in bytes (set to 0, lines will not be truncated).
    • MAX_TIMESTAMP_LOOKAHEAD = (integer): The maximum number of characters for a timestamp within an event.
    • TIME_PREFIX = (regex): A prefix that Splunk looks for up until the timestamp begins.
    • TIME_FORMAT = (format): Tells Splunk the timestamp’s format.
    • EVENT_BREAKER_ENABLE = (TRUE/FALSE): Used in load balancing data to indexers on a universal forwarder.
    • EVENT_BREAKER = (regex capture group): Specifies the event boundaries for multi-line events on a Universal Forwarder, if EVENT_BREAKER_ENABLE = true.

    OUTPUTS.CONF

    outputs.conf tells the Splunk instance where to forward data.

    This file is required on a forwarder. Indexers don’t typically need one, but search heads can have it to forward logs back to the indexers. This is especially important in clustered environments.

    The stanza header lists the type of output (tcpout, syslog, etc.), and then the target instance, separated by a colon. For example, tcp output going to indexer 1 would follow the format [tcpout:indexer1]. Overall output settings don’t include the target (e.g., [tcpout]).

    Attributes for an overall tcpout stanza include:

    • defaultGroup = (comma separated list) – Lists target group names.
    • indexAndForward = (Boolean) – When set to true, automatically indexes data before forwarding it (only available on heavy forwarders).

    Attributes for a target group tcpout stanza include:

    • server = (comma separated list) – One or more IPs to send data over.
    • indexerDiscovery = (string) – Set it to the IP of the manager node to enable indexer discovery in a clustered environment.

    outputs.conf settings are not limited to tcpout – different types of outputs have their own unique sets of settings.

    SERVER.CONF

    server.conf configures a wide variety of server options in Splunk.

    It includes a [general] stanza where one can configure the serverName, hostName, sessionTimeout, site (in a multisite cluster), parallelIngestionPipelines (for increased processing), and more.

    Another important stanza in server.conf is [clustering], which determines an instance’s role in an indexer cluster. Settings include:

    • mode = (string) – Sets the mode for this instance (manager, peer, searchhead, disabled).
    • manager_uri = (uri) – The URI of the cluster manager.
    • pass4SymmKey = (string) – A password set between cluster instances to successfully send data.
    • rolling_restart = (string) – On the manager, determines how indexers restart during a rolling restart.
    • multisite = (Boolean) – On the manager, determines if the cluster is in multisite mode.
    • replication_factor = (integer) – On the manager, determines the number of copies of rawdata in a cluster.
    • search_factor = (integer) – On the manager, determines the number of copies of searchable data in a cluster.
    • available_sites = (list) – Lists the sites in a cluster (required for a multisite cluster).

    Also included are options to configure SSL, search head clustering, KV Store configuration, and much more.

    INDEXES.CONF

    indexes.conf sets properties for Splunk indexes.

    Each stanza represents a given index with attributes, but default settings can go in the [default] stanza.

    There are several general settings, but here are some attributes that can be set on a per-index basis:

    • disabled = (Boolean) – Turns an index on or off.
    • deleted = true – If present, the index is set for deletion.
    • homePath = (string) – Sets the path of the hot and warm buckets for this index.
    • coldPath = (string) – Sets the path of the cold bucket for this index.
    • thawedPath = (string) – If a frozen bucket is thawed, this specifies the path for that bucket.
    • maxGlobalDataSizeMB = (integer) – The maximum size of a warm bucket, in MB.
    • maxDataSize = (integer) – The maximum size of a hot bucket, in MB, before it rolls over to a warm bucket.

    OTHER USEFUL GLOBAL CONF FILES

    There are 56 unique configuration files in Splunk and nearly 30 of them are global – too many to discuss here! They are all important in their own ways, but here are a few others to take note of:

    • authorize.conf.- Handles user roles and their permissions.
    • collections.conf – Handles KV Store settings for apps.
    • deploymentclient.conf – Handles settings for clients of a deployment server.
    • limits.conf – Handles limits for search commands.
    • serverclass.conf – Handles creating different groups of deployment clients on a deployment server.
    • transforms.conf – Handles data transformations (typically with regex), in tandem with props.conf. Can exist in both the global and app/user contexts.

    For further reading, this is a full list of Splunk conf files, and here is more on how to edit a conf file.

    Happy Splunking!

    Contact us here for more Splunk advice:

  • pass4SymmKey does not hash when pushed from Cluster Master

    pass4SymmKey does not hash when pushed from Cluster Master

    by Aaron Dobrzeniecki | Senior Splunk Consultant

    When working with a pass4SymmKey, the goal is to get the password to hash when Splunk restarts on the servers you have placed them on. I have noticed while working with many customers that pushing a pass4SymmKey from the Cluster Manager WILL NOT hash the password on the indexers. The screenshots below are using Splunk 8.2.5 and I am pushing a pass4SymKey to the indexers.

    NOTE, pushing passwords from a CM in Splunk version 9.0+ will hash the pass4SymmKey on the indexer AND cluster manager side.

    On the Cluster Manager:

    Terminal window showing the contents of the server.conf file on a Splunk Cluster Master, including a plain-text pass4SymmKey used for cascading replication

    In newer versions of Splunk they have included a directory called manager-apps. As you can see above, I am using master-apps which you can still use in 8.2.5. In order to migrate over from using master-apps vs manager-apps, you need to move ALL of the apps in master-apps to manager-apps and apply the cluster bundle. NOTE! You cannot use master-apps and manager-apps at the same time.

    I have applied the bundle to the indexers and this image shows the checksums matching!

    Splunk terminal output showing cluster-bundle-status across multiple indexers, indicating active and validated bundles with replication status marked as "success".

    Splunk Indexer 1:

    Splunk configuration file on indexer 1 showing an unencrypted pass4SymmKey in the cascading_replication stanza.

    Splunk Indexer 2:

    Terminal output from indexer 2 displaying the same plaintext pass4SymmKey as indexer 1 in the server.conf file.

    Splunk Indexer 3:

    Splunk configuration file from indexer 3 showing an unencrypted cascading_replication pass4SymmKey similar to other indexers.

    As you can see from the multiple screenshots above, the pass4SymmKey did not hash on the indexers when pushed from the Cluster Manager. Also, in the first screenshot you can see that the password is also in plain text on the Cluster Manager. This imposes a security risk as well on the Cluster Manager. If an unauthorized user was able to gain access to the Cluster Manager, they could easily find this pass4SymmKey.

    Now, the stanza I have used in my example is for cascading bundle replication from the Search Heads. Having a similar pass4SymmKey under that stanza on all indexers, allows the indexers to send each other knowledge object bundles originating from the Search Head. Pushing ANY pass4SymmKey in ANY stanza from the Cluster Manager will not hash the value. Click here for more information on cascading bundles on Splunk.

    Solution/Resolution
    An absolute way I have found to make sure the pass4SymmKey hashes is to place the stanza and pass4SymmKey in $SPLUNK_HOME/etc/system/local/server.conf and restart Splunk. I know what you must be thinking, “We have a large number of indexers that we would need to manually touch in order to place the pass4SymmKey in $SPLUNK_HOME/etc/system/local/server.conf”. IF YOU DO NOT have any sort of automation tool (puppet, ansible, bitbucket CICD, or even just a script that will reach out and touch every indexer), you will have to manually touch each box. If you do not have any automation tools but you have a person who can write a script to touch each box, try that before the manual process.

    Manually Setting pass4SymmKey in Splunk

    -Navigate to the CLI or backend of the indexers
    -cd $SPLUNK_HOME/etc/system/local (Make sure you are the user that is running Splunk)
    -If there is no current server.conf, you can create one
    -vi server.conf
    -Place the specific stanza and pass4SymmKey setting you will be using as below:

    Magnified section of a configuration file showing the same plaintext pass4SymmKey used in multiple nodes.

    Note: **You will need to restart the indexers for the hashing to occur. In an indexer cluster you will want to perform a rolling restart instead of restarting each indexer manually. **

    -Navigate to the GUI or the backend of the Cluster Manager

    –GUI: Settings -> Indexer Clustering -> Edit (Top Right) -> Rolling Restart -> Begin Rolling Restart (check the widgets as necessary)

    –Back End/CLI: Navigate to $SPLUNK_HOME/bin and run the following command
    ./splunk rolling-restart cluster-peers

    The screenshots below will show you, that after manually placing my pass4SymmKey in $SPLUNK_HOME/etc/system/local/server.conf and performing a rolling restart on the cluster; the pass4SymmKey hashes!

    Encrypted pass4SymmKey displayed in server.conf from indexer 1’s system local directory, differing from the plaintext versions.
    Encrypted pass4SymmKey shown in the system local directory of indexer 2, indicating local hashing applied.
    System local configuration on indexer 3 showing a hashed version of the pass4SymmKey used for cascading replication.

    In Conclusion

    Splunk versions pre 9.0 WILL NOT hash the pass4SymmKey when pushed from the Cluster Manager. If you would like to apply a pass4SymmKey on versions before 9.0, you will either need to use an automation tool to reach every indexer, or touch each server manually as explained above. Please see all server.conf files from each version of Splunk after the push from the Cluster Master/Manager.

    Splunk 8.2.5 Indexer
    Terminal output showing a plain text pass4SymmKey value set to aarontest123 within the server.conf file on Splunk instance idx1, located in /opt/splunk/etc/slave-apps/_cluster/local/.
    Splunk 8.2.5 Cluster Master
    Terminal output showing a plain text pass4SymmKey value aarontest123 within the server.conf file on the Splunk Cluster Master (master1) in the /opt/splunk/etc/master-apps/_cluster/local/ directory.
    Splunk 9.0 Indexer
    Terminal output from idx1 showing a hashed pass4SymmKey stored in server.conf under /opt/splunk/etc/peer-apps/_cluster/local/, indicating hashing occurs when key is set locally rather than pushed from Cluster Master.
    Splunk 9.0 Cluster “Manager”
    Terminal output on master1 showing a hashed pass4SymmKey value in the server.conf file located in /opt/splunk/etc/manager-apps/_cluster/local/, suggesting a manual edit on the Cluster Manager with proper hashing behavior.
    Splunk 9.0.1 Indexer
    Terminal output from idx1 again displaying a hashed pass4SymmKey in the server.conf file located in /opt/splunk/etc/peer-apps/_cluster/local/, reinforcing that peer-nodes apply hashing correctly when configured independently.
    Splunk 9.0.1 Cluster “Manager”
    Terminal view of another hashed pass4SymmKey entry in server.conf under /opt/splunk/etc/manager-apps/_cluster/local/ on the master node, used to demonstrate inconsistent behavior when keys are pushed versus manually configured.

    There you have it! If you still have questions about this, or any other Splunk item that you’d like help with, contact us! Submit your comments below and we will be in touch right away.