Adaptive Thresholding with Splunk's Density Function

It’s 3PM on a Friday, and your day is winding down. Suddenly, you get an urgent email from your boss asking you to set up an alert for monitoring volume. You consider this an easy task.

You set a hard threshold for what you think is a low volume based on the last four hours of incoming data. Then, you expand the timeline over several days and see the following:

The blue line represents the actual volume count per fifteen-minute granularity, while the red line is the upper limit and the green line is the lower limit. Clearly, hard thresholding will not work in this scenario because the data has a cyclical pattern.

Luckily, there are ways to get around this cyclical yet predictable data set. You can solve this problem by using the density function.

What is the density function?

Short for probability density function, the density function will learn from the past in order to create a model that will map out dynamic thresholding. From this, you can understand what is normal — relative to a certain hour of the day or a certain day of the week.

The density function ships with Splunk Machine Learning ToolKit, and it’s easy to use out of the box.

(Explore all the algorithms in the Machine Learning ToolKit.)

How the density function works

The density function works by looking over a large dataset of time series values.

In the following example, these values represent the number of calls received from customers over a 1-hour time period. The density function will create a model that illustrates the probability that a value will be within a particular range in a particular “bucket” of time. These buckets are defined as the “HourOfDay” and the “DayOfWeek.” If the value falls outside of the expected range, it will be considered an anomaly.

Before you can use the density function, you must fit the density function algorithm against your traffic volume field (i.e. “Actual”) to create the model.

The model acts as a relationship mapper, and it needs to be applied against unseen datasets in order to determine anomalous behavior. You can use a model that has already been built by using the apply command.

The apply command will generate a new field called “IsOutlier(Actual),” which will determine whether the model believes that the “Actual” value is anomalous at that point in time.

Benefits of the density function

The density function offers fast time to value (TTV) when solving complex problems. More importantly, it is easy to use, and most engineers can figure it out without a background in statistics.

The biggest challenge of using the density function is recognizing when you need it – more on this shortly.

Limitations of the density function

The density function has a default limit of 1,024 groups, which prevents you from achieving high time granularity and good results from the split-by entity. This means that your finest time granularity should be no less than 1 hour, with no more than 42 additional entity split-by groups. These limits are adjustable, but if you find yourself constantly bumping them up, this might not be the correct tool for the job.

False alerting can be one of the biggest drawbacks of using the density function to create adaptive thresholds. These false alerts may not be statistically false, but they may be too sensitive for the general business use case, and it may be alerting too much to provide any real value. Luckily, this can be adjusted by changing the sensitivity of your model.

For example, when you apply the model, you will get a new field called “IsOutlier(Actual),” which will have a binary 1/0 value. You can change the sensitivity by modifying the limits that create this value, which will maintain the integrity of the model while reducing the false alerts associated with it.

When to use the density function to create adaptive thresholds

Adaptive thresholding has a very narrow use case. For one, your data trends need to have a predictable historical pattern that is likely to continue into the future. For example, in our first image, you can see a cyclical pattern in which the volume is different at each hour of a particular day, but when you look at the same hour over the course of weeks, the volume is very similar.

If your dataset doesn’t have a predictable trend, then adaptive thresholding will probably not be a good solution.

Fitting a model (i.e., creating a machine learning model) using the density function can consume a lot of CPU because it needs a lot of data to learn from so that it can identify adaptive thresholds. The accuracy of the model directly correlates with the size of the training set. Therefore, it can be expensive to train models, so you may want to apply this technique only to high-value problems.

Density function is excellent for complex work

The density function is an excellent tool, since it provides fast time to value (TTV) when solving complex problems. You can create a model with it that can be used inside of your alerts to identify abnormal behavior at a particular time of day without relying on hard thresholds that will constantly fire false alerts. As with anything, there are costs associated with using this technique, so choose wisely!

FAQs about Adaptive Thresholding with Splunk's Density Function

What is density function adaptive thresholding?
Density function adaptive thresholding is a technique that uses statistical models to determine thresholds dynamically based on the distribution of observed data, rather than relying on static or manually set thresholds.
Why is adaptive thresholding important in anomaly detection?
Adaptive thresholding is important because it allows systems to automatically adjust to changes in data patterns, reducing false positives and negatives in anomaly detection.
How does density function adaptive thresholding work?
It works by modeling the probability distribution of normal data and setting thresholds based on the likelihood of observed values, so that rare or unlikely events can be flagged as anomalies.
What are the benefits of using density function adaptive thresholding?
Benefits include improved accuracy in detecting anomalies, reduced need for manual threshold tuning, and better adaptation to changing data environments.
Can density function adaptive thresholding be used in real-time monitoring?
Yes, density function adaptive thresholding can be implemented in real-time monitoring systems to dynamically adjust thresholds as new data arrives.

Related Articles

How to Use LLMs for Log File Analysis: Examples, Workflows, and Best Practices
Learn
7 Minute Read

How to Use LLMs for Log File Analysis: Examples, Workflows, and Best Practices

Learn how to use LLMs for log file analysis, from parsing unstructured logs to detecting anomalies, summarizing incidents, and accelerating root cause analysis.
Beyond Deepfakes: Why Digital Provenance is Critical Now
Learn
5 Minute Read

Beyond Deepfakes: Why Digital Provenance is Critical Now

Combat AI misinformation with digital provenance. Learn how this essential concept tracks digital asset lifecycles, ensuring content authenticity.
The Best IT/Tech Conferences & Events of 2026
Learn
5 Minute Read

The Best IT/Tech Conferences & Events of 2026

Discover the top IT and tech conferences of 2026! Network, learn about the latest trends, and connect with industry leaders at must-attend events worldwide.
The Best Artificial Intelligence Conferences & Events of 2026
Learn
4 Minute Read

The Best Artificial Intelligence Conferences & Events of 2026

Discover the top AI and machine learning conferences of 2026, featuring global events, expert speakers, and networking opportunities to advance your AI knowledge and career.
The Best Blockchain & Crypto Conferences in 2026
Learn
5 Minute Read

The Best Blockchain & Crypto Conferences in 2026

Explore the top blockchain and crypto conferences of 2026 for insights, networking, and the latest trends in Web3, DeFi, NFTs, and digital assets worldwide.
Log Analytics: How To Turn Log Data into Actionable Insights
Learn
11 Minute Read

Log Analytics: How To Turn Log Data into Actionable Insights

Breaking news: Log data can provide a ton of value, if you know how to do it right. Read on to get everything you need to know to maximize value from logs.
The Best Security Conferences & Events 2026
Learn
6 Minute Read

The Best Security Conferences & Events 2026

Discover the top security conferences and events for 2026 to network, learn the latest trends, and stay ahead in cybersecurity — virtual and in-person options included.
Top Ransomware Attack Types in 2026 and How to Defend
Learn
9 Minute Read

Top Ransomware Attack Types in 2026 and How to Defend

Learn about ransomware and its various attack types. Take a look at ransomware examples and statistics and learn how you can stop attacks.
How to Build an AI First Organization: Strategy, Culture, and Governance
Learn
6 Minute Read

How to Build an AI First Organization: Strategy, Culture, and Governance

Adopting an AI First approach transforms organizations by embedding intelligence into strategy, operations, and culture for lasting innovation and agility.