Ollama Excessive API Requests

 Original Source: [splunk source]
Name:Ollama Excessive API Requests
id:1cfab663-9adc-4169-a88c-6bae29ba3c70
version:5
date:None
author:Rod Soto, Nasreddine Bencherchali, Splunk
status:production
type:Anomaly
Description:Detects high Ollama API request volumes from a single client in a short time window. A burst may indicate automated abuse or contribute to resource contention, but GIN access logs do not establish malicious intent or service impact; validate the client and workload against local usage baselines.
Data_source:
  • -Ollama Server
search:`ollama_server`
"[GIN]"

| rex field=_raw "\|\s+(?<raw_status>\d+)\s+\|\s+(?<raw_latency>[\d\.]+(?:µs|ms|s))\s+\|\s+(?<raw_src>[^|]+?)\s+\|\s+(?<raw_method>\w+)\s+\"(?<raw_path>[^\"]+)\""

| eval src=coalesce(src, trim(raw_src))
| eval uri_path=coalesce(uri_path, raw_path)
| eval http_method=coalesce(http_method, raw_method)
| eval http_response_code=coalesce(http_response_code, raw_status)
| eval response_time_ms=coalesce(response_time_ms, case(match(raw_latency, "µs$"), tonumber(replace(raw_latency, "µs", ""))/1000, match(raw_latency, "ms$"), tonumber(replace(raw_latency, "ms", "")), match(raw_latency, "s$"), tonumber(replace(raw_latency, "s", ""))*1000))

| where isnotnull(src)

| bin _time span=5m

| stats count as request_count
dc(uri_path) as distinct_endpoints
values(uri_path) as endpoints
by _time src

| where request_count > 120

| eval severity="medium"

| eval attack_type="High Volume API Activity"

| `ollama_excessive_api_requests_filter`


how_to_implement:Ingest Ollama logs via Splunk TA-ollama add-on by configuring file monitoring inputs pointed to your Ollama server log directories (sourcetype: ollama:server), or enable HTTP Event Collector (HEC) for real-time API telemetry and prompt analytics (sourcetypes: ollama:api, ollama:prompts). CIM compatibility using the Web datamodel for standardized security detections.
known_false_positives:Legitimate automated services (CI/CD pipelines, monitoring tools, batch jobs), multiple users behind NAT/proxy infrastructure, or authorized load testing activities may trigger this detection during normal operations. Operator must adjust threshold accordingly.
References:
  -https://github.com/rosplk/ta-ollama
drilldown_searches:
 name:'View the detection results for - "$src$"'
 search:'%original_detection_search% | search src="$src$"'
 earliest_offset:'$info_min_time$'
 latest_offset:'$info_max_time$'
 name:'View risk events for the last 7 days for - "$src$"'
 search:'from datamodel Risk.All_Risk | search normalized_risk_object IN ("$src$") | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
 earliest_offset:'7d'
 latest_offset:'0'
analytic_story:['Suspicious Ollama Activities']

asset_type:Web Application

mitre_attack_id:['T1498']

product:['Splunk Enterprise', 'Splunk Enterprise Security', 'Splunk Cloud']

category:application

security_domain:endpoint

tags:

tests:
 name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/ollama/server.log
  sourcetype: ollama:server
  source: server.log
 test_type:'unit'
manual_test:None

Related Analytic Stories


Suspicious Ollama Activities