Tag: blog

  • 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.

  • Don’t “Fall” for Common Splunk Mistakes

    Don’t “Fall” for Common Splunk Mistakes

    The leaves are turning, the air is crisp, and something pumpkin-spiced is calling your name. But you can’t think about all that fall fun right now because you’re too busy troubleshooting your Splunk instance. We know that feeling, and that’s one of the reasons we frequently post hints and tips in this blog.

    With that in mind, we thought it would be helpful to reveal our most popular and common tactics for Splunk troubleshooting and finding solutions to give you that little nudge you need to get back on track.

    1. Troubleshooting in Splunk

    David Allen, a Senior Certified Splunk Consultant here at TekStream, starts us off with tips you can use to go from a novice to an expert. Read how the Search Job Inspector tool shows you where your Splunk system has been searching for issues, and how much time it’s been looking there. Dig into Execution Costs, Search Job Properties, and the BTOOL CLI command that reveals the actual settings on your SSD. These are standard functions that come with Splunk Enterprise software. You can rely on David’s problem-solving expertise as you dig into these issues and are invited to reach out if you have other questions.

    2. Troubleshooting Your Splunk Environment Utilizing BTOOL

    Going next level on the BTOOL utility, this popular post stresses that BTOOL is not a reflection of memory, but of what is written on your disk or your SSD. This tutorial walks you through the recommended steps for a Linux environment. Windows tutorials are available – just ask!

    3. The 3 Most Common Splunk Issues and How to Solve Them

    We end our roundup with a tidy list of three issues from Senior Splunk Consultant Aaron Dobrzeniecki. Data Quality, Search Performance, and High Resource Usage should be the first line of defense in your Splunk installation. You’ll see strategy and implementation advice with an eye to inspection. If you want more details, Aaron can be reached using the request at the end of the page.

    That should fix those issues – now you’re ready to go out there and “pumpkin-spice up” your fall!

    What other issues have you encountered in your Splunk environment? Check out other Splunk info and contact us for additional support.

  • Populating User Data for the Chargeback App

    Populating User Data for the Chargeback App

    By: Jeff Rabine | Splunk Consultant

    The Chargeback App is designed to help you identify how many SVCs your organization is using by Business Units and Departments. Recently I had a customer that wanted to define a Business Unit as a Vice President and a Department as a Director who reports to the VP. This is completely doable if you are ok with using the original field names that the chargeback app uses. The hardest part about configuring the Chargeback app is getting the data collected and formatted for the chargeback app to use. This blog post is not specifically about the Chargeback App. This blog is about collecting, formatting and populating the user data needed for the chargeback_user_2_bunit_csv_lookup.

    The challenge I had with collecting the user data is the data was not all in one place. I had an index that contained user data, and I had a CSV that identified Directors and VPs. What I needed though was a list of users and their associated Director and VP.

    I have formulated an example that contains less than 20 users, but this example is working in a production environment that contains over 50,000 users.

    In my example I use these two CSVs:

    Employee_List.csv

    Populating user data employee list csv

    management.csv

    A small table mapping VP IDs to Director IDs, used to enrich employee data for business unit association in chargeback workflows.

    The first step is to combine the two data sources and export them as a new CSV. We do this by using the lookup command.

    Screenshot of a Splunk search using lookup commands to merge employee data with management.csv for VP and Director mapping, displaying a preview of the enhanced employee list.

    Now that we have the data in a single CSV we can iterate through it to figure out who everyone’s VP and Director is. We do this by using the same lookup over and over as shown below. In this example, we only have to do it three times. In this real-world example, I did this eight times to fully populate the data.

    Splunk screenshot showing the use of nested lookup logic to retrieve manager hierarchy layers (Manager1 and Manager2) and align them with VP and Director values across employee records.

    As you can see, we now have much more data, but it is a mess. So lastly, we will coalesce the Director and VP data and we will rename the fields to match the Chargeback App requirements.

    Splunk interface showing a fully enriched user dataset with business unit and department IDs resolved via VP and Director coalescing logic, ready for use in the Chargeback App.

    As you can see, we now can identify the biz_unit or (VP) and biz_dep or (Director) for all our users.

    I hope this article will give you some ideas to when populating user data for the Chargeback app or help you iterate through a lookup multiple times to perhaps create an organizational chart. Happy Splunking!

    Want to learn more about lookups or the Chargeback App? Contact us today!

  • Tuning Your AWS WAF Configuration in Terraform

    Tuning Your AWS WAF Configuration in Terraform

    How to Implement Bot Control, Scope-down Statements, Allow US-only traffic, and/or Whitelist Exceptions to Rules Based on Whitelisted IPs or Header Information

    By: Brandon Prasnicki | Senior Cloud Architect

    AWS WAF is a Web Application Firewall that helps protect your web applications or APIs against common web exploits and bots that may affect availability, compromise security, or consume excessive resources. In this article, I describe and show the AWS WAF configuration in Terraform for a few use cases that may come in handy for your implementation.

    The first is bot control. Reducing bot traffic is rather simple when using WAF in AWS.  There is a managed rule you can use and documentation on how to create exceptions to allow certain traffic. Sometimes implementing the rules with Terraform can be a little tricky; this article contains an example use case you can use to help with your implementation.

    Amazon AWS describes this feature here and has documentation about the AWSManagedRulesBotControlRuleSet WAF rule here.

    Here are the steps on how the solutions were implemented.

    First, adding the rule was as straightforward as any other managed rule addition following the link below (The terraform is also included at the bottom of this article)

    With this enabled, we can quickly see bot traffic being rejected by navigating to:

    AWS WAF Bot Control diagram.

    And also:

    AWS WAF overview.

    And scrolling to the bottom of sampled requests and selecting the ManagedRulesBotControl block metric:

    AWS WAF ManagedRulesBotControl screenshot.

    Some of these blocks are false positives and may require whitelisting. For this, I have an IP set that I am using for known hosts and clients.

    Known hosts and clients IP screenshot.
    AWS WAF IP sets.

    I added the IPs to the IP set and used this IP set to whitelist rule for known hosts:

    IPs added to the IP set and used this IP set to whitelist rule.

    This whitelist IP set list was also used to whitelist IPs of non-US users to bypass the ‘Non US’ Geo Code Match Statement (DisallowNonUSTraffic seen in the Terraform below).

    However, not all requests were coming from known server hosts. Some requests were coming from client machines’ Tableau Desktop applications where the IPs were not static or always known. For this, I created a scope-down statement to grab the header information and allow anything that starts with ‘Tableau Desktop’ for the user-agent.

    Here is a screenshot of what this looks like in the console following this breadcrumb:

    AWS WAF - Web ACLs - ManagedWAFv2 - AWSManagedRulesBotControlRuleSet.

    Then you can click edit in this rule set to add a ‘Not Scope-down statement’ that will appear like this:

    NOT Scope-down statement.

    On the left you can see the blocked request with header information alongside the rule:

    Blocked request with Header info.

    Here is the Terraform for the IP set for whitelisting:

    Terraform for the IP set for whitelisting.

    Below is the entire Terraform for the web ACL.

    Here you will see:

    1. The implementation of the out-of-the-box AWSManagedRulesKnownBadInputsRuleSet_rule, AWSManagedRulesAmazonIpReputationList and AWSManagedRulesWindowsRuleSet.
    2. The exception rule to allow any whitelisted IPs.
    3. Disallowing any non-US traffic (not already included in whitelisted IPs).
    4. The web ACL with the whitelisted IP set referenced along with the scope-down statement in the AWSManagedRulesBotControlRuleSet.
    5. The scope-down statement to allow the Tableau Desktop communication.
    Terraform code defining an AWS WAFv2 Web ACL with two managed rule groups: KnownBadInputsRuleSet and AmazonIpReputationList, including CloudWatch metric configuration and override actions.
    Continuation of Terraform WAF rules including WindowsRuleSet, a whitelist IP set rule, and a geo-blocking rule for non-US traffic, each with visibility configuration and action settings.
    Terraform code configuring a bot control rule using AWSManagedRulesBotControlRuleSet with an exception for requests from Tableau Desktop identified by user-agent, including nested scope-down statements and visibility configuration.

    (Click here to download PDF of the code)

    These are just a few examples that can help manage your AWS WAF configuration in Terraform. The analysis of what rules to use and how to use match statements and scope-down statements might be the hardest part.

    TekStream can advise and help you implement these features and of course, assist with your implementation project or even support you in a ‘Consulting as a Service’ manner. Reach out today to see how we can help!

  • 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. 

  • OAuth2 Authentication Tokens in Splunk

    OAuth2 Authentication Tokens in Splunk

    By: Jon Walthour | Technical Architect

    Authentication tokens in Splunk allow you to access Splunk via the REST interface, usually serviced on port 8089 on a search head, without needing to pass a username/password combinations in the call. The type of tokens Splunk employs are JSON web tokens.

    To utilize an authentication token to access Splunk via API, you would use a curl command something like the following:

    curl -X GET -H "Authorization: Bearer <auth-token>" https://ualasiem.splunkcloud.com:8089/servicesNS/admin/search/search/jobs/export -d search="search index%3D_internal|head 3" -d output_mode=xml

    To set up and administer tokens, go to Settings > Tokens (under “Users and Authentication”). To administer tokens, you need to have the “edit_all_tokens” capability.

    Here is what you can do with the tokens in Splunk in terms of reporting and alerting:

    For reporting, here’s an example SPL to get you started. NOTE: All of these searches and alerts should be run from the Monitoring Console app on your Monitoring Console instance so that all search heads can be queried and reported on at once. However, they could be run from any search head by changing “splunk_server_group=dmc_group_search_head” to “splunk_server=local”:

    | rest splunk_server_group=dmc_group_search_head /services/ authorization/tokens | convert ctime(claims.exp), ctime(claims.iat), ctime(claims.nbr) | rename claims.aud as audience, claims.exp as expiration_date, claims.iat as issued_at_date, claims.idp as identity_provider, claims.iss as issuer, claims.nbr as not_before_date, claims.roles as roles, claims.sub as user, headers.alg as algorithm, headers.kid as kid, headers.ttyp as token_type, headers.ver as version, lastUsed as last_used_date, lastUsedIp as last_used_from_ip_address, title as token | eval last_used_date=if(last_used_date=0,"not yet used",strftime(last_used_date,"%m/%d/%Y %H:%M:%S")), last_used_from_ip_address=if(last_used_from_ip_address=""," not yet used",last_used_from_ip_address) | table token status user roles audience issued_at_date not_before_date expiration_date last_used_date last_used_from_ip_address issuer issued_at_date identity_provider splunk_server

    You can also find token-related setup information at:

    | rest splunk_server_group=dmc_group_search_head /services/ admin/Token-auth/tokens_auth

    An example alert you could use for expiring tokens, say those that are going to expire in the next 30 days:

    | rest splunk_server_group=dmc_group_search_head /services/ authorization/tokens | where ‘claims.exp’ < relative_time(now(),”+30d”)

    Additionally, with the “not before date” (claims.nbr) entry, it would be possible to set up multiple future-date, even overlapping, tokens for the same user. So, for example, you could set up two tokens for an API user today–one starting today for the next 90 days and one that started on day 89 and extended 182 days. This would give you two tokens spanning six months that had a two-day overlap period. Now, set an alarm on your calendar on days 89 and 90 to, on one of those days, go into the source system using the token to send API calls to Splunk and swap out the old token for the new one. You’d have two days to get the swap out made and potentially no loss of service.

    If you would like additional support with your authentication tokens in Splunk or any other Splunk issue please contact us right away.

  • Make Unstructured Data Searchable with a Multikv Command

    Make Unstructured Data Searchable with a Multikv Command

    Jeff Rabine | Splunk Consultant

    Splunk works best with structured data. This blog post will cover how to make unstructured data searchable. In this real-world example, the customer wanted to use data in the second table of an unstructured log file. Changing the log format was not an option, and access to .conf files was not available, so all changes needed to happen at search time.

    Raw log sample:

    Raw log sample where we need to make unstructured data searchable.

    As you can see, there are two tables of data in the log. The first step is to remove the top table from the results since it’s unnecessary for this search. We will do that using the rex command to over-write _raw capturing only the data that we need.

    Two tables of data after running Splunk search.

    The next step is to use the multikv to break the tables into separate events. This command will attempt to create fields and values from the table however, in our case, we removed the headers from the table because the formatting of our table was not clean. This caused the multikv command to not work properly. Since we removed the headers, we will set them to noheader=t.

    Search result screen for using Multikv noheader=t command to break tables into separate events.

    Now, the last thing we need to do is create our field extractions, and then we can use the data however we please.

    Final image multikv after manipulating data.

    As you can see, we now have nice clean data!

    Other uses of the multikv command:

    Depending on your data, there are other ways to use the multikv command. Neither of these examples was able to make unstructured data searchable for our customer, but I recommend trying them with your data. Your success with the following examples will depend on how cleanly formatted your logs are.

    In our example, we stripped out the headers of the table to make unstructured data searchable. You may be able to leave the headers. That would save you from extracting the fields with the rex command. Also, by default, the command will attempt to process multiple tables within the log, so you might just have to use the multikv command. After running this search, check to see if the correct fields were extracted.

    index="fruitfactory" sourcetype="fruitfactory"
    | multikv

    You can also tell the command what row contains the headers of the table. This would allow you to always look for the headers on the first, second, etc row of the event. Again, check and see if the correct fields were extracted after running this command.

    index="fruitfactory" sourcetype="fruitfactory"
    | multikv forceheader=

    Want to learn more about unstructured data or using the multikv command? Contact us today!

  • Splunk Issue: Indexers Failing to Rejoin the Cluster (Solved)

    Splunk Issue: Indexers Failing to Rejoin the Cluster (Solved)

    Yetunde Awojoodu | Splunk Consultant

    Indexers failing to rejoin the cluster can cause serious issues, but this blog will provide simple steps to help resolve the issue in your environment. First, indexers in a Splunk environment can be clustered or non-clustered. In an indexer cluster environment, there can be two or more indexers also called peer nodes. Each peer node indexes external data, stores them, and simultaneously sends and receives replicated data. These indexing and replication activities are coordinated by a cluster master. The cluster master is also responsible for managing the configuration of peer nodes, searching of peer nodes and remedial activities if a peer goes offline.

    A peer node will need to be connected to the cluster master and stay connected to receive instructions. There are however situations in which a peer node could become disconnected from the cluster master. A peer could go offline intentionally by issuing the CLI offline command or unintentionally as in a server crashing or due to intermittent or recurring network issues in the environment.

    When a peer gets disconnected from the cluster master and the master does not receive a heartbeat after a set period, the master begins bucket fixing activities to ensure the defined replication factor is met so that the cluster remains in a healthy state. Refer to Splunk docs if you are interested in learning more about what happens when a peer goes down.

    Depending on the reason for the disconnection, indexers in a cluster may go offline for a few minutes or hours. In my situation, a partial datacenter outage had caused multiple appliances to fail and resulted in failed connections among the Splunk servers. This caused about half of the indexers to lose connection to the cluster master for several hours.

    The datacenter issue was later determined to be a result of storage shortfalls and was resolved within 24 hours but once the datacenter was restored, however, we noticed the indexers failing to rejoin the cluster. The master would not allow them back into the cluster.

    Problem Indicators

    There were multiple errors in Splunk that pointed to issues with the indexers:

    i. Messages indicating failed connection from Cluster Master to the Indexers

    ii. Messages indicating indexers being rejected from joining the cluster

    iii. Cluster Master in an unhealthy state – Replication and Search factor not met

    iv. Most Splunk servers including search heads in red status

    v. No replication activities as seen on the Indexer Clustering Dashboard on the Cluster Master

    vi. Indexers with “BatchAdding” status on the Indexer Clustering dashboard

    Below is a screenshot of some of the error messages seen in Splunk:

    Indexer failing to join back cluster Failed to add peer error image.

    What Happened?

    We found that during the datacenter outage, the disconnected indexers continued to perform activities such as rolling hot buckets to warm using the standalone bucket naming convention rather than the naming convention for buckets in a clustered environment. Since the cluster master did not recognize the standalone buckets it didn’t stop those specific indexers failing to rejoin the cluster. More on this

    The screenshot below shows examples of standalone nonreplicated buckets:

    Indexer fails to join back cluster examples of standalone nonreplicated buckets.

    Below is another screenshot of what buckets originating from the local indexer in a cluster should look like:

    Indexer fails to join back cluster buckets originating from the local indexer in a cluster should look like.

    *Note that the buckets prefixed with “rb” are replicated buckets from other indexers in the cluster.

    Solution

    The solution is to rename each standalone bucket to cluster bucket convention. This was a manual effort that took us a few hours to complete but it may be possible to develop a script especially if there are several indexers failing to rejoin the cluster. In my scenario, we had a total of 9 indexers of which 5 were disconnected.

    Below are steps to resolve the issue:

    i. Identify the indexers that are unable to join the cluster

    ii. Put the Cluster Master in maintenance mode

    iii. Stop Splunk on one indexer at a time

    iv. Locate the standalone buckets in the indexed data directories on each indexer. The default location is $SPLUNK_HOME/var/lib/splunk/*/db/

    v. Append the cluster master GUID to the standalone buckets.

    vi. Start Splunk

    This process requires great attention to detail to avoid messing up the bucket names. I will recommend having other members of your team on a video conference to watch out for any errors and validate any changes made.

    How to Locate and Rename Each Bucket

    To locate the erroneous buckets, we developed a regex to match the expected format and issued a find command on the CLI to identify them.

    ➣ find /opt/splunk/var/lib/splunk/* -type d -name “db*” | grep -P “db_d*_d*_d*$”

    *Make sure to replace “/opt/splunk/var/lib/splunk/*” with your specific indexed data directory path

    On each indexer, go to each data directory in the results from the “find” command and scroll through to identify the bucket names missing the local indexer guid. Once found, append the correct local indexer guid to the bucket name as it appears in the other bucket names. Note that the guid to be appended is different for each indexer. It is the guid for the local indexer so make sure to copy the correct guid from another bucket on that indexer or check $SPLUNK_HOME/etc/instance.cfg file on that indexer for the correct guid to be appended. As a precaution, feel free to back up the buckets (or just rename to .old) before appending the guid and delete the old directories once the indexers are restored.

    Bucket Name Format without Guid – db_<newest_time><oldest_time><bucketid>

    Bucket Name Format with Guid – db_<newest_time><oldest_time><bucketid>_<guid>

    Once you have appended the correct guid to each standalone bucket, the bucket name will look like this as shown in a screenshot above:

    db_1640917434_1639072107_161_E56FC9B8-EACF-4D96-8B76-4E28FCF41819

    Remember to restart each indexer after the changes have been made and watch out for status changes and replication activities on the indexer clustering dashboard. Note that you may need to wait for a few hours to get the cluster back to a healthy state but not much should be required once the indexers have been restarted.

    If you experienced similar errors, as shown above, these simple steps should help resolve the issue in your environment.

    If you need additional assistance wrangling your Splunk indexer storage.

    You can always contact one of our Splunk consulting and managed service specialists.

  • Deleting the Unsupported Splunk Windows Universal Forwarder

    Deleting the Unsupported Splunk Windows Universal Forwarder

    By: Aaron Dobrzeniecki | Splunk Consultant

    Have you ever encountered an issue when you are trying to install a new version of Splunk over an older unsupported version of Splunk? Having an older unsupported version of Spunk Univeral Forwarder installed can cause issues with your data ingesting into your Splunk indexers. Please see the Splunk Compatibility Matrix here. In the situation below we encountered compatibility issues because we were in the middle of upgrading our Splunk environment to 8.x. The Splunk Universal Forwarder 6.5.2 is not compatible with 8.x indexers so the data from those forwarders would not ingest into Splunk. Without deleting the unsupported Splunk Windows Universal Forwarder you’ll have huge issues! We ran into an issue with a Windows Universal Forwarder that was on version 6.5.2 of Splunk, and we were trying to upgrade the Universal Forwarder to 7.3.3. (Since Splunk 7.3.3 has reached the end of support as well, you would want to install the latest version of the Splunk Universal Forwarder). When we tried to install the new version over the current version we received an error that the installation package for the current version was missing. Since Splunk 6.5.2 has reached the end of support and was removed from the website, we were unable to get the older install from Splunk.com because that version does not exist anymore. We were not able to get the 6.5.2 installation package to uninstall the Universal Forwarder from our machine. NOTE: If you have Splunk VPN you can access the older versions of Splunk. We have two options: Delete the unsupported Splunk Windows Universal Forwarder or grab the current version from behind the Splunk VPN. For this exercise, we are going to be ripping the Splunk agent from the Windows box because we do not have Splunk VPN access. Please follow the steps below:

    1. Open the Command Prompt as an Administrator

    2. Run: sc stop SplunkUniversalForwarder

    3. Run: sc delete SplunkUniversalForwarder

    This stops, then deletes, the Splunk Windows service. You may have to do this for a second Splunk service. Older Splunk Universal Forwarder software had two services, although when tested with 7.1.x, it installed only one service.

    4. You can find the internal service name by right-clicking on it in the Services Control Panel, select “Properties”, and look for the “Service Name” at the top of the dialog box.

    5. Run: rmdir /s /q “C:Program FilesSplunkUniversalForwarder”

    6. From the same Command Prompt, run:

    regedit

    This will open the Registry Editor.

    7. Search for “Splunk”. You should find an item under “HKEY_CLASSES_ROOTInstallerProducts<SOME GUID>”

    8. In the details, you’ll see a key for “ProductName”, and the value will be “Universal Forwarder”.

    By seeing this, you know you have got the right item.

    9. Right-click on the GUID in the left-hand pane and select “Delete” to delete the entire entry from the registry. Now, the Splunk installer should see your host as a new install.

    From here you can install the latest version of the Splunk Universal Forwarder for Windows. The reason we were unable to remove the Splunk program was due to the registry not being able to find the installation file for Splunk. (The 6.5.2 installation did not exist on the box anymore and we did not have a backup copy of the installation) After deleting the unsupported Splunk Windows Universal Forwarder from the registry we were able to move forward and make our Forwarder compatible with the rest of the Splunk environment.

    If you are looking for a Splunk Managed Service Provider, check out our Evaluation Checklist or fill out the form below to speak with one of our expert Splunk consultants.

  • Slice And Dice: Comparing Values Over Specific Times

    Slice And Dice: Comparing Values Over Specific Times

    Part One: Day Over Week

    Marvin Martinez | Splunk Consultant

    If you’re lost, you can look and you will find it: Time OVER time. Sometimes, data can’t just be visualized sequentially. Often, it is most useful to compare data across specific points in time. In this 4-part series, I will be outlining some interesting ways to help visualize data points across specific points in time, namely day over week (i.e. this past Thursday versus the last three Thursdays) and hour over week (this past Thursday at 1 p.m. to last three Thursdays at 1 p.m.). The first installment will focus on the day-over-week visualization that allows the user to quickly visualize the last four Thursdays (or any other day of the week) overlayed on top of each other to quickly determine any discrepancies between them.

    For example, let’s say you’re monitoring sales throughout the day. You notice that sales seemed to spike up at 8 p.m. yesterday, but you’re curious if it is spiking up at that same hour every Thursday or if the peaks are happening at different times and how big those discrepancies are.

    Splunk has some very handy, albeit underrated, commands that can greatly assist with these types of analyses and visualizations. Additionally, it can be difficult to clearly display the appropriate context and intent of the visualizations, so it is imperative to clearly delineate what the data points represent on the charts themselves. We’ll explore both situations in this article, including some sample SPL to help you get where you need to get with your own data.

    To achieve this, we’ll use the timewrap command, along with the xyseries/untable commands, to help set up the proper labeling for our charts for ease of interpretation.

    In the end, our Day Over Week Comparison chart will look like this. The chart shows each Thursday across the past four weeks, overlayed on top of each other. (Note that you could go back as far as your data lets you go. This is just how far back we went for the purpose of this article.)

    Line chart titled “Day Over Week Comparison” showing multiple data lines representing values for different Thursdays in late 2021, enabling side-by-side comparison of daily performance over time.

    This is the search that was used for the panel shown above. Each of our events has a TotalSales field that we are using as our value to chart.

    | index=”test” ….
    | eval Date = strftime(_time,”%m/%d”), Day = strftime(_time,”%A”), Hour=strftime(_time,”%H”)
    | fields _time, “TotalSales”, Hour, Day, Date
    | where Day=”Thursday”
    | timechart span=1h count(TotalSales) as TotalSales
    | timewrap 1w series=short
    | rename TotalSales _s0 as LatestDay, TotalSales _s1 as WeeksBack1, TotalSales _s2 as WeeksBack2, TotalSales _s3 as WeeksBack3, TotalSales _s4 as WeeksBack4
    | untable _time FieldName FieldValue
    | eventstats latest(_time) as LatestDate
    | eval WeekNum = substr(FieldName,-1)
    | eval FieldName = CASE(FieldName = “LatestDay”, “Latest Thursday”,1=1,”Thursday (” . strftime(relative_time(LatestDate,”-” . WeekNum . “w@h”),”%m/%d”) . “)”)
    | xyseries _time FieldName FieldValue
    | table _time “Thursday*” “Latest *”

    Let’s break this search down and explain what is going on here. The first four 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.

    The timewrap command requires a timechart command before it, so execute a timechart command to get the data the way you need it (in this case, spanned across an hour). Note that you are already only looking at a specific day across multiple weeks.

    Now execute the timewrap command, spanning one-week intervals and using the series=short option. This creates the resulting fields as “TotalSales_s0…” and so on. This is helpful since they can then be easily renamed in the next command to make it easier to understand which date each series represents. At this point, if you ran the search just up to the rename command after the timewrap, your visualized result should look something like this:

    Line chart displaying performance trends across an entire week for different weekday series, highlighting variations in behavior by time of day across dates in December 2021.

    This is almost there, but still not intuitive when viewing. Let’s work on that!

    The “| untable _time FieldName FieldValue” command will reformat the data as shown below, with a FieldName and FieldValue column, containing the field names and values, respectively. We can use this to rename our fields to make them easier to understand.

    Data table listing timestamped entries with associated field names and numerical values, organized for comparison between the latest day and three prior weeks.

    The following eventstats and eval commands do just that. Eventstats will determine what the latest date is in the remaining events. We will use this to help determine the actual date of the other line values. The eval commands grab the last number from the FieldName and then use a CASE statement to update the name of the field. If the FieldName is “LatestDay,” then we know it is the most recent day in our data set. Otherwise, we will update the field name to be the name of the day followed by a relative_time offset going back the WeekNum number of weeks.

    | eval WeekNum = substr(FieldName,-1)
    | eventstats latest(_time) as LatestDate
    | eval FieldName = CASE(FieldName = “LatestDay”, “Latest Thursday”,1=1,”Thursday (” . strftime(relative_time(LatestDate,”-” . WeekNum . “w@h”),”%m/%d”) . “)”)

    After these commands, your results should look something like this. Note that the FieldName is now intuitively named.

    Spreadsheet-style table comparing values by timestamp, with fields showing latest Thursday metrics versus previous Thursday dates and their respective values.

    From here, all we need to do is use the xyseries command to turn these field names back into columns for our chart.

    | xyseries _time FieldName FieldValue

    At this point, the chart will look pretty much the way we need it to.

    Repeat view of “Day Over Week Comparison” chart showing performance trends for different Thursdays, emphasizing line pattern consistency or deviation across hours

    However, we need this to be as easy to read as possible! Looking at the legend, the fields aren’t quite in the right order. Note how “Latest Thursday” is at the top but the other series do not follow sequentially in the right time order. We can fix that with the table command to control the ordering of our chart. Order the table command with _time, followed by the “Thursday” entries (use the * to denote a wildcard) and, finally, the “Latest *” field at the very end.

    | table _time “Thursday*” “Latest *”

    Now, your chart looks like this. Much better! The dates in the legend now show in ascending order and are easier to follow.

    Another instance of the “Day Over Week Comparison” chart, highlighting overlapping and diverging values across Thursday dates for hourly intervals.Figure 1: Dotted lines were added via dashboard panel options for fieldDashStyles and lineDashStyle

    In the next installment, we will create a panel that will allow us to compare one specific day from a prior week to the latest day and visualize the percentage changes between the two throughout every hour of that day. A sneak peek is shown below. Until next time!

    Comparison chart showing percentage change between the current week and three weeks prior, with green shaded area indicating positive or negative deltas and trend lines for each week plotted by hour.

    Visualizing data doesn’t have to be complicated.  Check out Part Two of our Slice and Dice Series and stay tuned for Part Three coming Spring 2023.

    Contact one of our exceptional Splunk Consultants today so we can put your data to work for you!