Tag: blog

  • Looping Around the Block – Using Loops with Ansible Blocks

    Looping Around the Block – Using Loops with Ansible Blocks

    By William Phelps, Senior Technical Architect

    It’s a real “task” to use Ansible sometimes.

    In reality, everything in Ansible is a task. A task is the basic work unit within an Ansible playbook. A task is also the smallest unit of work within an Ansible script.

    Each task calls an Ansible “module” to perform its intended function. Once a task is completed, the next task is called. That next task can be blissfully unaware of anything that happened in the previous task (or any previous tasks as well.) This is actually a very powerful feature at times, as different tasks can then have differing environment variables or a different user executing each task. For example, think of needing to execute one or more tasks as root, whereas the rest of the play is meant to be executed with lower privilege.

    However, today’s topic initially looks at the need to execute a series of tasks as more or less a unit or “block”. Each task creates a result that subsequently needs to be passed to one or more following tasks. If a task fails, either the play stops with an error, or it needs to enter some kind of error handler.

    In general programming terms, this approach is called a try/catch/finally approach. Ansible uses the terminology block/rescue/always to refer to the same thing. Here is a schematic example:

    YAML code example showing an Ansible task block that includes a main block of commands, a rescue section for error handling, and an always section to execute final steps. Demonstrates control flow using blocks.

    Obviously this snippet would do very little, but merely illustrates the basic premise of an Ansible block.

    So now let’s further consider a use case where there this type of block needs to be executed repeatedly. For an example, there exists a list of file names in a folder. That list of files (or some attribute of each file) must be evaluated in the context of the block, and some series of actions must occur for each file.

    Normally, such looping is achieved in Ansible using the with_items or loop parameter within a task. For example, this snippet installs several packages using the yum module.

    Ansible playbook snippet using a loop to install multiple required libraries with the yum module. Features variables and with_items for iteration over packages.

    Depending on the Ansible module (in this case “yum”), the module may or may not support the with_items argument or the “loop” argument. “block” is one such module in Ansible. It also does not appear that Ansible will ever add such support.

    The approach to get around this limitation lies in a module called include_tasks. This module can work inside of a block, and also can accept loop arguments. For example:

    An Ansible task that loops over a list of files, using include_tasks to call an external subtasks.yml file, showing how to modularize repeated actions across items.

    All of the operations that need to looped then reside in the subtasks.yml file.  A simple example could be as shown:

    Contents of subtasks.yml, defining two tasks: one for copying a file to a specific location using a shell command, and another to echo the file name, both using {{ item }} to iterate over a list.

    Once the loop is finished, the next task in the main playbook script is executed.

    Don’t be thrown for a loop. This post is intended as more of a conceptual teaching post for Ansible rather than a working example. Please contact us if there is a need for working code for a real-world scenario.

  • Security Bulletin: SPLUNK it to detect MOVEit

    Security Bulletin: SPLUNK it to detect MOVEit

    By Bryan Bollou, Team Lead, Cybersecurity Engineering

    Background

    On May 31st, 2023, it was announced that there was an expanding occurrence of the MOVEit vulnerability – an application used on over 2.5k servers on the internet. This was a critical vulnerability that could be exploited using SQL injection to do the following: 

    • Obtain a list of all folders, files, and users within MOVEit 
    • Download any file within MOVEit 
    • Insert an administrative backdoor user into MOVEit and give attackers an active session to allow credential bypass 

    Since then, a patch has been released that will prevent this exploitation of systems. So, the issue is resolved, right? Absolutely not! We know change management processes can take a while, even in serious situations like this. It may take many cycles before the proper patching is done to your machines to stop this attack. You may have already put in some workarounds to prevent the attack such as disabling ports 80 and 443 on the web servers or some detections to see the exploit. So far, we have seen many good options and would like to present a few specific cases using everyone’s favorite SIEM: Splunk.

    Objective

    The purpose of this security bulletin is not to fully explain or give recommendations on remediating the vulnerability, as has been discussed at length by various resources such as Progress Community.

    Our goal here is to aggregate the detections to maximize your chances of detecting this critical attack. A part of that is gathering the list of IOCs scattered in multiple locations on the internet and looking at activity that could point to the MOVEit vulnerability being exploited. Here at TekStream, we have several security engineers that are intimate with cybersecurity knowledge and especially the logs of our clients.

    We will walk you through the various steps in the MOVEit vulnerability exploitation and detection. With this format, we are providing a more generic data model “tstats” command. This is taking advantage of the data model to quickly find data that may match our IOC list. We then provide examples of a more specific search that will add context to the first find. There will be a wide variety of specific searches as each client has their own specific technologies. To get help building detection for your specific client, fill in the form below and get access to our Splunk/security expertise.

    The following detection steps mirror the stages and TTP-related indicators used in the attack:

    1. Detect initial malicious file spawning SQL Injections
    2. Search for potential beaconing web traffic containing specific parameters
    3. Detect existence of downloaded malicious script
    4. Detect ancillary signs of malicious script activity
    5. Persistent malicious file install
    6. Detect data exfiltration
    7. Scan for related known malicious IPs
    8. Scan for related known malicious web domain

    Detections

    Step 1

    As part of the exploitation, a backdoor named “human2.aspx” was uploaded to multiple sites, this was a main file responsible for performing the SQL injection and exfiltrate sensitive data. Other executable files leveraged in the attack include:

    moveitisapi.dll to perform SQL injection directed by specific headers seen below.

    guestaccess.aspx to create a session and grab CSRF tokens and other parameters for more actions.

    Actions to Detect
    GET /human2.aspx – 443 
    POST /moveitisapi/moveitisapi.dll
    POST /guestaccess.aspx
    GET /human2.aspx

    SPL

    | tstats `summariesonly` sum("Web.bytes") as bytes,values("Web.http_content_type") as http_content_type,values("Web.http_method") as http_method,values("Web.http_user_agent") as http_user_agent,values("Web.status") as status from datamodel="Web"."Web" where (http_method = GET AND Web.url = "*human2.aspx*") OR (http_method = POST AND Web.url = "*/moveitisapi/moveitisapi.dll*") OR (http_method = POST AND Web.url = "*/guestaccess.aspx*") OR (http_method = GET AND Web.url = "*/human2.aspx") by "Web.src", "Web.dest", "Web.user", "Web.url", _time | fields _time src, dest, user, url, http_content_type, http_method, http_user_agent, status, bytes | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
    
    

    Step 2

    In the backdoor code, there is a check for specific parameters that will tell the malicious script what action to perform. Looking for the specific string of this request could be used to detect attempts to exploit the MOVEit Vulnerability. Search for web requests that contain any of the request or response headers listed below:

    Parameters to Detect
    X-siLock-Step1
    X-siLock-Comment
    X-siLock-Step2
    X-siLock-Step3

    SPL

    | tstats `summariesonly` sum("Web.bytes") as bytes,values("Web.http_content_type") as http_content_type,values("Web.http_method") as http_method,values("Web.http_user_agent") as http_user_agent,values("Web.status") as status from datamodel="Web"."Web" where Web.url = "*X-siLock-Step1*" OR Web.url = "*X-siLock-Comment*" OR Web.url = "*X-siLock-Step2*" OR Web.url = "*X-siLock-Step3*" by "Web.src", "Web.dest", "Web.user", "Web.url", _time | fields _time src, dest, user, url, http_content_type, http_method, http_user_agent, status, bytes | fieldformat Time = strftime(_time,"%m/%d/%Y %T")

    Step 3

    As mentioned above, depending on the parameters supplied, the malicious script can do multiple actions. Some include creating a backdoor user or deleting it. The account is called “Health Check Service” and doing searches for the existence of the user in a MOVEit database, or any account activity would help in detecting the exploit.

    Activity to Detect
    IF X-siLockStep1 = -2
    A backdoor user called Health Check Service is removed from the users table, potentially as a method to cover tracks.

    IF X-siLockStep1 = null AND X-siLock-Step2 = null AND X-siLock-Step3 = null
    The malicious script creates an administrative user named Health Check Service in the users table. It also creates and inserts a new active session for this user into the application.

    SPL

    | tstats `summariesonly` latest(_time) as _time from datamodel="Change"."All_Changes" where nodename="All_Changes.Account_Management" (All_Changes.user="Health Check Service" OR All_Changes.src_user="Health Check Service") by "All_Changes.action", "All_Changes.src", "All_Changes.Account_Management.src_user", "All_Changes.dest", "All_Changes.user"  | fields _time, action, src, src_user, dest, user
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
    

    Step 4

    Like the above, with different parameters, the malicious script looks to enumerate information about the targeted MOVEit instances. It uses a malformed Azure account that can be detected.

    Activity to Detect

    IF X-siLockStep1 = -1
    The script will attempt to leak Azure information via the response header and return a GZIP stream of all files, file owners and file sizes, and institution data present in MOVEit instance. Account to Detect- azureAccout

    SPL

    index=azure (sourcetype="azure:aad:audit" "initiatedBy.user"=" azureAccout") OR (sourcetype="azure:aad:signin" userPrincipalName=" azureAccout ")

    Step 5

    The posting of the malicious file “human2.aspx” will add the file to the C:MOVEitTransferwwwroot directory on the MOVEit instance. This filesystem path is based on install locations and can vary (for example it can be E drive). The detections here are to detect any files that are created in these vulnerable locations.

    File and File Location to Monitor

    :MOVEitTransferwwwroot
     human2.aspx
     App_Web_*.dll

    SPL

    | tstats `summariesonly` latest(_time) as _time, latest(Filesystem.file_create_time) as file_create_time, latest(Filesystem.file_modify_time) as file_modify_time, latest(Filesystem.file_access_time) as file_access_time from datamodel="Endpoint"."Filesystem", values(Filesystem.dest) as dest, values(Filesystem.action) as action, values(Filesystem.file_name) as file_name, values(Filesystem.file_hash) as file_hash, values(Filesystem.file_path) as file_path, values(Filesystem.file_size) as file_size where (Filesystem.file_name = "*human2.aspx" OR Filesystem.file_name = "*App_Web_*.dll" OR Filesystem.file_path = "*:MOVEitTransferwwwroot*") | fields _time, dest, action, file_name, file_hash, file_path, file_size, file_create_time, file_modify_time, file_access_time
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
    

    Step 6

    Detecting the exfiltration of data is another way to find out if a bad actor is exploiting the MOVEit vulnerability. Examine firewall logs for large outbound network transfers from the MOVEit environment. 

    IPs and Volume to Detect

    IPs – these will be your MOVEit Instance IPs
    Volume in bytes – this will depend on time (defaulted to 1 hour in this detection) and what is considered abnormally high volume in your environment (default to 1MB in this detection).

    SPL

    | tstats `summariesonly` values(_time) as _time, sum("All_Traffic.bytes") as bytes, values("All_Traffic.src_port") as src_port, values("All_Traffic.transport") as transport, values("All_Traffic.dest_port") as dest_port from datamodel="Network_Traffic"."All_Traffic", values("All_Traffic.action") as action where All_Traffic.src="[INSERT MOVEit INSTANCES IPS]” AND All_Traffic.action !=blocked AND All_Traffic.dest_category !=internal AND All_Traffic.bytes > 1000
     by  "All_Traffic.dest" , "All_Traffic.user", "All_Traffic.src", _time span=1h
    | rename "All_Traffic.dest" as dest, "All_Traffic.user" as user, "All_Traffic.src" as src
    | table_time, action, src, src_port, dest, transport, dest_port, user, bytes
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T") 

    Step 7

    There are several IP addresses that have been associated with the exploitation of the MOVEit vulnerability. TekStream has consolidated a list of these IOCs from numerous sources on the internet. These IOCs can be added to a lookup table and used in the detection below.

    TekStream MOVEit IOC List

    This CSV has the list of the IOCs at the time of this blog post being written – for a more updated version and/or information on how to build the lookup in the detection, please contact a TekStream consultant below.

    Search firewall and MOVEit IIS logs for requests from any of the IP addresses specified within the IOCs below.

    IPs To Detect

    In this case, you will look for any and all of the IP’s on the TekStream MOVEit IOC List

    SPL

    | tstats `summariesonly` values(_time) as _time, sum("All_Traffic.bytes") as bytes, values("All_Traffic.src_port") as src_port, values("All_Traffic.transport") as transport, values("All_Traffic.dest_port") as dest_port from datamodel="Network_Traffic"."All_Traffic", values("All_Traffic.action") as action
     by  "All_Traffic.dest" , "All_Traffic.user", "All_Traffic.src"
    | rename "All_Traffic.dest" as dest, "All_Traffic.user" as user, "All_Traffic.src" as src
    | eval allips = mvappend(src, dest)
    | inputlookup TS_MOVEit_IPs_List.csv | fields ip | rename ip as allips
    | table_time, action, src, src_port, dest, transport, dest_port, user, bytes
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T")

    Step 8

    There is a domain associated with the MOVEit vulnerability and it is detectable with the logic below.

    Domain to Detect

    dojustit[.]mooo[.]com

    SPL

    | tstats `summariesonly` latest(_time) as _time  values("DNS.dest") as dest, values("DNS.query") as query, values("DNS.query_count") as query_count, values("DNS.message_type") as message_type, values("DNS.answer") as answer, values("DNS.reply_code") as reply_code from datamodel="Network_Resolution"."DNS" where DNS.query="dojustit[.]mooo[.]com" | table _time, dest, query, query_count, message_type, answer, reply_code | fieldformat Time = strftime(_time,"%m/%d/%Y %T")

    IOC List

    Below is an aggregate of IOCs found related to the MOVEit vulnerability. It has been presented here for you to have it consolidated in one spot and made easier to export to a lookup for notable detections.

    TekStream MOVEit IOC List

    Conclusion

    Ideally, you could make scheduled searches like what is shown above with lookup tables for matching more specific and new detections. These can be set to run on a continuous schedule to ensure the monitoring of your assets from new vulnerabilities. Old vulnerabilities that have been patched (and applied) can also be aged out of this lookup table to ensure it is timely and efficient. For questions on how to build such a process that is dynamic and customizable for your environment, ask one of our consultants by filling in the form below.

    References

    Articles referenced and used for this post: Trusted SEC, Huntress, Progress Community

    Disclaimer: The approaches recommended herein have not been tested broadly across the TekStream customer base. They are preliminary in nature and come without any certification of efficacy.

    We are available to assist if you have any questions, just contact us here:

  • Creating Splunk Cloud Architecture Diagrams Using Lucidchart

    Creating Splunk Cloud Architecture Diagrams Using Lucidchart

    By Kamal Dorairaj, Senior Splunk Consultant

    Knowledge is valuable, and in the case of the Splunk installation at your firm a visual representation of the platform configuration becomes a key asset. The diagram gives better understanding of the Splunk Cloud Implementation and is useful for internal training as well as documentation needs at your company. In this blog, we will offer a step by step process for creating a Splunk cloud architecture diagram using Lucidchart.

    The architecture diagram is best created in Lucidchart, which has all Splunk shapes, icons and images. It also has a library of shapes for all of the leading products you may be using, like AWS, Google Cloud Platform (GCP), Azure and other security products. You can also import shapes from external sources and use it for the diagram. Lucidchart provides options to export the diagram in various formats including pdf, Visio, jpeg, png and csv.

    Discovery

    In the discovery phase you will gather all the information required for the architecture diagram. Ask yourself these questions to ensure you include the essential materials:

    • Which Splunk systems are being used in the environment? Examples include UF, HF, DS, etc.
    • Where do the UFs forward to? Heavy Forwarders, Indexers, or a mix?
    • What kind of data collection is taking place? Ex: Syslog, HEC, API.
    • What is the list of data sources per HF? This will include the vendor/product lists.
    • Which host has what type of Apps/Data collection?
    • What are the IP, host name, cpu/memory/disk spaces of each HF/UF/DS?
    • Are you using Splunk Premium Products in addition to Splunk Enterprise? These might include enterprise security, UBA or ITSI.

    Diagram Creation Process

    The diagram should be closely associated to the Splunk Validated Architecture based on the environment.

    Architecture Layers
    Login: Users access Splunk Cloud Search Head through ‘https 443’ via the internet.

    Splunk Cloud Search Head Tier and Indexing Tier: The Search Head on the cloud got an Adhoc SH (customer.splunkcloud.com) and SH for the premium product if there is one. Ex: ES SH (escustomer.splunkcloud.com). The SH on the Cloud talks to the Indexing Cluster Tier through port 8089. Splunk does not allow to put any indexers or search head host details in the diagram.

    Getting Data thru HEC and API: Apps or data that send through HEC (http event collector) token-based to Splunk Cloud Platform is a fast and efficient way. The HEC data flows to Splunk Cloud through port ‘https 443’. Getting Data in through APIs to Splunk Indexing layer by configuring the API inputs through an authentication type.

    On-Prem Collection Tier: This part of the architecture lives on the customer network side. We have Heavy Forwarder and Universal Forwarder. The instances could be on unix or windows. Both the HFs and UFs forward the data to the Splunk Indexing tier thru port ‘TCP 9997”.

    On-Prem Management Tier: The DS has all the apps and config files which pushes the changes thru ‘TCP 8089” to the HFs and UFs. Many times, the license master is installed in the same DS server instances.

    Syslog Sources: There could be single or multiple syslog sources that send data thru ‘TCP UDP 514’ in a network load balancer to the UFs or HFs. The syslog can also configure to flows thru SC4S.

    PORT Details:
    TCP 8089 -> Splunk Management Port
    TCP 9997 -> Splunk Data
    HTTPS 443 -> Splunk Web
    TCP UDP 514 -> Syslog
    TCP 8191 -> KV Store Replication
    TCP 9777 -> SHC Replication
    TCP 9887 -> IDX Replication

    This is what a typical Splunk cloud architecture diagram will look like:

    Detailed architecture diagram of a Splunk Cloud deployment created in Lucidchart. The image shows multiple tiers: users connecting via HTTPS, the Splunk Cloud search tier, indexing tier, and on-premises tiers for collection and management. Data flow is represented with color-coded lines for different protocols, such as TCP 9997 for data and HTTPS 443 for web. Components include forwarders, heavy forwarders, syslog sources, SC4S, deployment servers, and AWS CloudTrail.

    Have fun creating diagrams of your own. As always, we are here if you have any questions. Contact us here:

  • Using Splunk to Search LDAP & Monitor for Last Time Password Was Set by Active Users on Windows OS

    Using Splunk to Search LDAP & Monitor for Last Time Password Was Set by Active Users on Windows OS

    by Patricia Orea-Arebun, Splunk Consultant II

    This use case helps to monitor active user accounts on Windows OS that have not updated their passwords in the client system in more than “n” number of days. The “n” number of days depends on organizational policy. Using your Splunk instance is the best way to search for changes and monitor active updates.

    Risk

    The risk involved in having active user accounts with passwords not changed is that the organization might be susceptible to brute force attacks. A brute force attack is where an attacker will be trying to access a company’s network by trying all possible passwords until they get lucky (dangerous!!!!).

    Control

    Using LDAP can help set monitoring in place for active users whose passwords are yet to be changed or nearing expiration (based on organization policy). LDAP, or Lightweight Directory Access Protocol, is a communication protocol that provides the ability to access and maintain distributed directory information services over a network. LDAP is used in Microsoft’s Active Directory but can also be used in other tools. Querying the LDAP directory requires using the Supporting Add-on for Active Directory (SA-ldapsearch) from Splunkbase in order to use the ldapsearch command. The ldapsearch command will display the users, their respective organizational units, lastLogonTime, created date, pwdLastset and so on.

    SPL Query

    Begin your query like this:

    |ldapsearch domain=<**your company domain**> search="(&(objectClass=user)(!(objectClass=computer)))" 
    | search userAccountControl!=ACCOUNTDISABLE 
    | rex "OU=(?<OU>[a-zA-Zs]+),DC" 
    | eval lasttime=strptime(pwdLastSet,"%Y-%m-%dT%H:%M:%S.%6N")
    |eval diff=round(((now() - lasttime)/86400),2)  
    | eval timediff = n - diff 
    | stats values(whenCreated) as "Created Date" latest(lastLogonTimestamp) as "LastLogonTime" values(OU) as OU values(sAMAccountName) as sAMAccountName values(pwdLastSet) as PWDLastSet values(timediff) as "Time left to change password"  by displayName
    SPL Analysis
    | ldapsearch domain=<**your company domain**>   search="(&(objectClass=user)(!(objectClass=computer)))" 

    This is querying the ldap tree for users, service accounts and not computers.

    | search userAccountControl!=ACCOUNTDISABLE

    This is searching for the active users and service accounts and ignoring disabled accounts

    | rex "OU=(?<OU>[a-zA-Zs]+),DC" 

    This is optional and depends on the use case. This is a field extraction for the list of “Organizational Unit” that each user or service accounts belongs to in the ldap tree.

    | eval lasttime=strptime(pwdLastSet,"%Y-%m-%dT%H:%M:%S.%6N")

    Converts the “pwdLastSet” timestamp field to current Unix epoch time to allows make further comparisons by creating a field “lasttime”.

    |eval diff=round(((now() - lasttime)/86400),2)  

    Converts the “lasttime” (the last time password was set in days) by creating a new field called “diff”.

    | eval timediff = n - diff

    Assuming your organizational policy for password change is “90 days” where n = number of days. This will calculate the “the time left to change password after n days”.

    | stats values(whenCreated) as "Created Date" latest(lastLogonTimestamp) as "LastLogonTime" values(OU) as OU values(sAMAccountName) as sAMAccountName values(pwdLastSet) as PWDLastSet values(timediff) as "Time left to change password" by displayName

    This search will tabulate resulting fields by the User’s displayname.

    Result

    Any user/service account that is non-compliant or has not changed the password within the Organization’s policy will have a negative sign (-) before the accrued number of days, signifying the number of days their password has been not being changed. The user accounts that are compliant will have a positive sign (+) before the number of days, signifying the number of days left to change their password.

    Example of a dashboard panel of an active user accounts list.
    Example: Dashboard Panel of Active User Accounts

    This can be turned into the following knowledge objects.

    Alert
    Splunk will send an email alert to the admin with list of user/service accounts with negative sign (-) to take action and user/service accounts with the number days left to change password.

    Dashboard Panel
    This can form part of a Splunk dashboard that will be constantly monitored by an Admin.

    Report
    Splunk can be set to send a report to the admin on a monthly or quarterly basis with the list of active user accounts and how much time left to change their password.

    That will do it! Now you’ll equip your team with brute force security monitoring for passwords using Splunk. If you would like more details, please contact us using the form below. Happy Splunking!

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

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

    By Marvin Martinez, Team Lead – Security Operations

    Part Three: Specific Hour Over Day Visualization

    Welcome back to our series discussing some unique ways to visualize data across specific points in time with Splunk SPL! Previously, we created a dashboard chart to isolate and compare a specific day from a prior week, and then we isolated and compared it to the same day from the current week to see the percentage change between the two values across the day in a new area chart visualization. In this installment, we will pick a specific hour from one day and chart out those specific values across a prior set of weeks in a straightforward visualization.

    Referring back to our first installment (Figure 1 below), we showed a full day across four weeks, overlayed in one line chart visualization. Then, in our second installment, we isolated one of these specific days to compare to the current week (Figure 2).

    Splunk dashboard line chart comparing total events across four Thursdays, showing consistent trends and a sharp dip after 4 a.m. on December 16.
    Part One: Day Over Week (Figure 1)
    Line graph with shaded green delta area visualizing percent change between current week and three weeks prior by the hour, highlighting early-morning fluctuations.
    Part Two: Isolate and Compare (Figure 2)

    Now, for example, let’s say we noticed that spike at 10 am where the Compared Week is much higher than the Current Week and we want to see if that’s just an anomaly or a consistent trend at that same hour. One thing that would make it easy to visualize this would be a line chart that charts that specific hour for that day of the week across the past 4 weeks.

    Let’s build that very search! Once we’re done, our visualization will look as shown below. In the image below, two dropdown inputs are populated with the specified day of the week and hour to isolate for the past 4 weeks, including the current week. This is just a line chart but it is isolated to just that specific day/hour across the past 4 weeks, which makes it much easier to visualize without any other data points to distract the view.

    Splunk dashboard line chart comparing total sales at 10 a.m. over four weeks, with tooltip showing a drop to 1.99 sales on December 9.
    Visualizing a specific day/hour (Figure 3)

    The complete search consists of various parts and transformation so let’s break it up into the few major steps that comprise it and analyze it to ensure we understand how this cake is baked. The final search is below:

    Index=test…
    | eval Date = strftime(_time,"%m/%d %I %p"), Day = strftime(_time,"%A"), Hour=strftime(_time,"%H"), TotalSales = round(TotalSales,2)
    | fields _time, "TotalSales", Hour, Day, Date 
    | where Day="Thursday" AND Hour = 10
    | sort 0 - _time
    | streamstats dc(Date) as WeekNum current=true
    | eval WeekNum = WeekNum -1, WeeksBefore = WeekNum . CASE(WeekNum = 0, " Current Week",WeekNum = 1, " Wk Prior",1=1," Wks Prior") . " (" . Date . ")"
    | chart values(TotalSales) as "Week Value" by WeeksBefore 
    | sort 0 - WeeksBefore
    | eval WeeksBefore = IF(match(WeeksBefore,"^0s"),substr(WeeksBefore,3),WeeksBefore)
    

    Now 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 days and hour we are looking to compare. In this case, Thursday is the selected day and 10 am is the selected hour but this could easily be replaced with a token here to allow dynamic selection of any day of the week (it actually is in our specific dashboard).

    | sort 0 - _time
    | streamstats dc(Date) as WeekNum current=true
    | eval WeekNum = WeekNum -1, WeeksBefore = WeekNum . CASE(WeekNum = 0, " Current Week",WeekNum = 1, " Wk Prior",1=1," Wks Prior") . " (" . Date . ")"
    

    The next three lines of the search allow us to format and prepare the data so that the chart will be easy to understand with descriptive labels on the x-axis. The sort command just sorts our data by descending time order so that the subsequent streamstats command can appropriately categorize the date in terms of how many weeks before the event is in relation to the current week. The eval command after this takes the WeekNum value, adjusts it so it reflects the appropriate relation to current week and then creates a WeeksBefore field that contains text values to better articulate how many weeks before the value presented is from, as well as identifying the current week and labeling it appropriately. We’ll discuss what needs to be further finalized on this field for optimal readability a bit later but we can continue for now.

    | chart values(TotalSales) as "Week Value" by WeeksBefore
    | sort 0 - WeeksBefore
    | eval WeeksBefore = IF(match(WeeksBefore,"^0s"),substr(WeeksBefore,3),WeeksBefore)
    

    Now that we’ve isolated and appropriately categorized and formatted our data, all that is needed is a chart command to group the values by the WeeksBefore field. Then, sort the results in descending order by WeeksBefore to ensure that the values are displayed in chronological order once placed in the visualization/line chart. If you were to run the search at this point, you’d notice that the WeeksBefore field has values like this:

    Splunk table column listing timestamps labeled as “3 Wks Prior,” “2 Wks Prior,” “1 Wk Prior,” and “0 Current Week,” all referencing 7 a.m.
    WeeksBefore field after running search (Figure 4)

    In order to get the field to display the right value for the current week (without the 0), the eval command at the end cleans up the data so that the “Current Week” value for WeeksBefore is labeled appropriately using the match function with some simple regex. Once applied, the values look as follows:

    Similar Splunk table as above, confirming week-based timestamps labeled by relative time and date for 7 a.m.
    WeeksBefore field after eval command removes the “0” on the Current Week label (Figure 5)

    The visualization is now ready! It will display much like a timechart but over a certain time period for only that day/hour data point across multiple weeks and with helpful, dynamic, and descriptive labeling on your x-axis!

    Stay tuned for our fourth and final installment in this series on unique Splunk Dashboard panels, when we will discuss how to pick one single time value from a day (i.e. a specific hour value) and plot that data point back across various weeks, comparing each prior data point to the current week (same hour/day) and showing percentage deltas along the way. A sample image is shown below.

    Area chart comparing hourly percent change for December 9 at 10 a.m., showing a highlighted pink delta area between current and prior week’s values.

    Part Four Sneak Peek: Hour Over Week Percentage Change Timechart (Figure 6)

    Until next time, please contact us for more information on this specific Splunk dashboard tutorial, or any Splunk questions you may have!

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

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

    By Marvin Martinez, Team Lead – Security Operations

    Part Two: Isolate and Compare

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Splunk Views: How to Embed Hyperlinks in a Custom App 

    By Nate Hufnagel, Splunk Consultant

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

    Directory Tree

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

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

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

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

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

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

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

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

    Splunk Default Stylesheets

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

    Creating the App and Custom Views via Web UI

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

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

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

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

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

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

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

    Once finished, click “Save”

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

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

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

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

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

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

  • The Nitty-Gritty of Sorting Lexicographically in Splunk

    The Nitty-Gritty of Sorting Lexicographically in Splunk

    By David Allen, Senior Splunk Consultant

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

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

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

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

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

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

    Numbers are sorted before letters

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

    Uppercase letters are sorted before lowercase letters

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

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

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

    Punctuation strings are sorted lexicographically

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

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

    Here is the output:

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

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

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

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

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

  • Beginner’s Guide to Splunk Global Configuration Files

    Beginner’s Guide to Splunk Global Configuration Files

    By: Eric Levy | Splunk Consultant

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

    SPLUNK CONF FILE

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

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

    CONF FILE PRECEDENCE

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

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

    EDITING CONF FILES

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

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

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

    INPUTS.CONF

    inputs.conf is used for specifying input data sources.

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

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

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

    PROPS.CONF

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

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

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

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

    OUTPUTS.CONF

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

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

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

    Attributes for an overall tcpout stanza include:

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

    Attributes for a target group tcpout stanza include:

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

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

    SERVER.CONF

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

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

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

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

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

    INDEXES.CONF

    indexes.conf sets properties for Splunk indexes.

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

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

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

    OTHER USEFUL GLOBAL CONF FILES

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

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

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

    Happy Splunking!

    Contact us here for more Splunk advice: