Tag: Splunk

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

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

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

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

    By: Greg Becker | Senior Splunk Consultant

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

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

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

    1. Read the docs

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

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

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

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

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

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

    juniper_netscreen,index,ns_index

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

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

    3. Important HEC token settings

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

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

    Check the docs here:

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

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

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

    Sources:

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

    Create a new Issue:

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

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

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

  • Troubleshooting Null Field Values and Trailing Spaces

    Troubleshooting Null Field Values and Trailing Spaces

    By: Jeff Rabine | Splunk Consultant

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

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

    Empty String and Trailing example.

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

    Field values and trailing known for bad IP.

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

    Field values or trailing spaces.

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

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

    Empty string and trialing coalescing IP addresses.

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

    Empty string and trailing eval character length.

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

    Empty string and trailing space on some IP addresses.

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

    Empty string and trailing inline field extraction.

    Empty string and trailing inline field extraction.

    Trim:

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

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

  • What’s Your State of Observability Maturity?

    What’s Your State of Observability Maturity?

    By: Brent McKinney | Senior Splunk Consultant

    Your MSP Can Help You Mature More Quickly

    Splunk recently released its 2nd annual State of Observability Report based on surveys from 1250 observability practitioners, managers, and experts across various industries. It measures their success with observability as the organizations accelerate the transition of workloads to the cloud, public cloud, and multi-cloud environments while also shifting more applications to a cloud-native architecture.

    You can download the complete report here.

    Key Insights from the Report

    It’s clear from the report that observability is becoming a business imperative as organizations embrace cloud-centric environments. It’s also evident that the more mature a company’s observability platform, the greater the ROI and bottom-line impact observability can make in the organization.

    Specific findings:

    • ● Companies with robust observability platforms are 2.1x likely to detect problems in internally developed applications in minutes.
    • ● Leaders in observability adoption report a 69% improvement in resolution means time for performance degradation or unplanned downtime.
    • ● Organizations with a mature observability platform achieve an average annual cost of downtime of $2.5 million – compared to $23.8 million for beginner observability platforms and even more-so for companies without any observability platform.

    There is a growing recognition that to achieve observability maturity; observability must be built into the DNA of the organization. An increased focus on automation and collaboration are also critical to scaling and maturing observability efforts.

    Four Focus Areas for Achieving Observability Maturity

    As a Splunk MSP and Splunk 2021 Partner of the Year, TekStream has had a front-row seat in working with clients at all levels of observability maturity, and our experience echoes many of the issues covered in the report.

    Here are four critical areas for organizations looking to apply observability to improve their operational efficiency and reduce service-affecting downtime and security vulnerabilities:

    1.     Monitor Microservice-Based Architecture

    According to the 2021 State of Observability Report, cloud-native applications are significant and expected to grow, with 34% of internally developed applications using containers and microservices-based architecture in a cloud-native environment.

    There are many moving parts in a microservices-based architecture, and it can be challenging to get visibility into each. Companies with mature observability protocols know that Splunk can help them monitor each service and the interactions between those services.

    Observability provides granular insight into the health of microservices performance and relationships, in real-time, through the open-source open telemetry collector for gathering metrics and traces.

    Even better, as the system is built with cloud-native and microservices architectures, Splunk Observability comes with hundreds of integrations and pre-built visualizations.

    2.     Ensure True End-to-End Visibility

    Splunk Observability tools provide visibility into an application’s health, uptime, and user experience, from infrastructure to front-end performance. This level of visibility allows you to see precisely how the health of one component of an application affects the application’s performance.

    Here again, we see organizations that have invested in maturing their observability skill set achieve greater levels of visibility compared with organizations that are starting on their observational journey – although even self-proclaimed beginners in observability can achieve better visibility than those companies with no observability platform.

    The report found that 66% of leaders stated their visibility into application performance is excellent. 64% of this same group reported visibility into their security position was excellent. When asked these same questions, only 44% of observability beginners claimed excellent visibility into their application performance, while 42% of beginners stated they had excellent visibility into their security practices.

    3.      Gain Confidence with More Reliable and Faster Development

    The report found that year over year, confidence in using Splunk Observability for reliable and faster development rose for all levels.

    However, only 35% of Spunk Observability users stated they were completely confident that they could meet application performance and availability requirements, whereas 71% of Splunk Observability leaders could confirm confidence across the same areas.

    There are a few key areas where Splunk Observability can help organizations gain confidence in their development process:

    • ● Application performance monitoring (APM),
    • ● Distributed tracing
    • ● Log management
    • ● Anomaly Detection

    4.     Use Splunk Observability Under the Guidance and Support of Your MSP

    Splunk Observability maturation doesn’t happen by accident. It takes careful planning, leadership buy-in, capital investment, and a roadmap to success. It also takes time.

    This is where a trusted MSP can provide significant value.

    Finding the right partner can help your organization reach maturity quicker, more efficiently, and at a reduced cost. We developed our QuickStream process for Splunk Observability Cloud to begin delivering value in 2-3 weeks. Not months.

    Together, we can help you reap the benefits and improved ROI that can come from a mature Splunk Observability implementation:

    • ● Global Monitoring of Amazon Container Services
    • ● Real-time Fidelity Tracing
    • ● Automated Incident Response

    The Future State of Observability

    The future state of observability is likely to be more data-driven and automated. The proliferation of the cloud and the continued pressure to bring ideas to market quicker will drive the need for organizations to invest in maturing their observability platform. And as systems become more complex, observability will become even more essential. If you’re not already using observability to monitor your system, now is the time to start.

    Whether your organization is new to the concept of observability, or your team is well-seasoned with the Splunk Observability Platform, TekStream can help. We have deep experience helping to guide our clients through their observability maturation journey –
    regardless of their starting point.

    To learn more about our Splunk Observability capabilities, contact us today.

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

  • Monitor Splunk Alerts for Errors

    Monitor Splunk Alerts for Errors

    Zubair Rauf | Senior Splunk Consultant – Team Lead

    In the past few years, Splunk has become a very powerful tool to help teams in organizations proactively analyze their log data for reactive and proactive actions in a plethora of use cases. I have observed almost every Splunker monitor Splunk Alerts for errors. Splunk Alerts use a saved search to look for events, this can be in real-time (if enabled) or on a schedule. Scheduled alerts are more commonplace and are frequently used. Alerts trigger when the search meets specific conditions specified by the alert owner. Triggered alerts call alert actions which can help owners respond to alerts. Some standard alert actions are to send an email, add to triggered alerts, etc. Other Splunk TAs also help users integrate external alerting tools like PagerDuty, creating JIRA tickets, and many other things using these tools. Users can also create their own custom alert actions which can help them respond to alerts or integrate with external alerting or MoM tools. There are times that they may fail due to different reasons and a user may not get the intended alert they set up. This can be inconvenient for users and if the alerts are used to monitor critical services, this can have a financial impact as well and can prove to be costly if alerts are not received on time. The following two searches can help users understand if any triggered alerts are not sending emails or the alert action is failing. Alert actions can fail because of multiple reasons, and Splunk internal logs will be able to capture most of those reasons as long as proper logging is set in the alert action script. Please note that the user running the searches need to have access to the “_internal” index in Splunk. The first search looks at email alerts and will tell you by subject which alert did not go through. You can use the information in the results of index=_internal host=<search_head> sourcetype=splunk_python ERROR | transaction startswith=“Sending email.” endswith=“while sending mail to” | rex field=_raw “subject”=(?P<subject>[^”]+)”” | rex field=_raw “-s(?<error_message>.*)swhilessendingsmailsto:s(?P<rec_mail>.*)” | stats count values(host) as host by subject, rec_mail, error_message Note: Please replace <search_head> with the name of your search head(s), wildcards will also work. Legend; host - The host the alert is saved/run on subject - Subject of the email - by default it is Splunk Alert: <name_of_alert> rec_mail - Recipients of the email alert error_message - Message describing why the alert failed to send email

    The second (below) search looks through the internal logs to find errors while sending alerts using alert actions to external alerting tools/integrations

    | transaction action date_hour date_minute startswith=“Invoking” endswith=“exit code” | eval alert_status = if(code=0, “success”, “failed”) | table _time search action alert_status app owner code duration event_message | eval event_message = mvjoin(event_message, “ -> “) | bin _time span=2h | stats values(action) as alert_action count(eval(alert_status=“failed”)) as failed_count count(eval(alert_status=“success”) as success_count latest(event_message) as failure_reason by search, _time | search failed_count>0 Note: Please replace <search_head> with the name of your search head(s), wildcards will also work. These two searches can be setup as their own alert, but I would recommend setting these up on an Alert Monitoring dashboard.  Splunk Administrators can monitor Splunk Alerts periodically to see whether any alerts are failing to send emails or any external alerting tools integrations are not working. Splunk puts a variety of tools in your hand but without proper knowledge, every tool becomes a hammer.

    To learn more and have our consultants help you with your Splunk needs, please feel free to reach out to us.