Compare commits

...
14 Commits
Author SHA1 Message Date
Josh Patterson 248fa193db Say whole number in the lsheap and esheap validation message
The regex only accepts whole numbers, so 1.5g is rejected; the message
now says so.
2026-12-04 08:04:04 -05:00
Josh Patterson 9152e6fce0 Require a unit on lsheap and esheap in SOC Configuration
Without forcedType or regex, SOC accepted a unitless heap such as 500.
AlignBestGuess stored it as a YAML integer, which rendered -Xms500
(bytes) and restart-looped the service. On the next save, AlignType
then tried ParseInt on the corrected 500m and rejected it.

forcedType: string makes SOC store the value as a string whatever the
stored type, so an existing integer can be corrected. The regex blocks
unitless values in the UI. k, m and g are allowed (either case), matching
what the bundled JDKs accept for -Xms/-Xmx; the Logstash JVM options
parser passes them through unchanged. Heaps too small to start fail in
the JVM whatever the unit, so the regex doesn't check size.
2026-12-04 08:04:04 -05:00
Jorge Reyes 62a7ba40f6 Merge pull request #16433 from Security-Onion-Solutions/reyesj2/610
fix so-elastic-agent-monitor
2026-12-03 11:19:26 -06:00
reyesj2 7ec2dec143 Log so-elastic-agent-monitor errors to syslog and stop at Fleet's 10000-result limit 2026-12-03 10:10:39 -06:00
Jorge Reyes df44fe7670 Merge pull request #16437 from Security-Onion-Solutions/reyesj2-patch-5
so-log-check false positive
2026-12-02 14:12:43 -06:00
reyesj2 2773b8479f so-log-check false positive 2026-12-02 14:08:10 -06:00
Mike Reeves da7bdd63cd Merge pull request #16432 from Security-Onion-Solutions/TOoSmOotH/597
FEATURE: Built-in Postgres alarms matching the InfluxDB alarms
2026-12-02 12:29:26 -05:00
Josh Patterson 5a59a83fef Merge pull request #16417 from Security-Onion-Solutions/m0duspwnens/598
FIX: Auto-applied pushes fail after a salt-master restart or on a newly added node
2026-12-02 11:08:54 -05:00
Mike Reeves dfcfa580e5 Add example alarm definitions to SOC grid settings 2026-12-02 10:22:17 -05:00
Jason Ertel 99ee0d9750 Merge pull request #16436 from Security-Onion-Solutions/jertel/wip
avoid false positive log check
2026-12-02 09:39:45 -05:00
Jason Ertel 80c5c38cd5 avoid false positive log check 2026-12-02 09:36:08 -05:00
Mike Reeves 4fa5b48035 Add example alarm definitions to SOC grid settings 2026-12-01 15:41:31 -05:00
Mike Reeves ce91c5249b Add example alarm definitions to SOC grid settings 2026-11-30 17:53:28 -05:00
reyesj2 4f9981ebf9 accept items or .list in response and check agents past the first page_size (default 250) 2026-11-30 15:56:18 -06:00
6 changed files with 184 additions and 21 deletions

No files matched your search

+2
View File
@@ -164,6 +164,7 @@ if [[ $EXCLUDE_FALSE_POSITIVE_ERRORS == 'Y' ]]; then
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|syncing rule" # false positive (rule sync log line includes rule name which can contain 'error') EXCLUDED_ERRORS="$EXCLUDED_ERRORS|syncing rule" # false positive (rule sync log line includes rule name which can contain 'error')
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|request_unauthorized" # false positive (login failures to Hydra result in an 'error' log) EXCLUDED_ERRORS="$EXCLUDED_ERRORS|request_unauthorized" # false positive (login failures to Hydra result in an 'error' log)
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|adding index lifecycle policy" # false positive (elasticsearch policy names contain 'error') EXCLUDED_ERRORS="$EXCLUDED_ERRORS|adding index lifecycle policy" # false positive (elasticsearch policy names contain 'error')
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating index lifecycle policy" # false positive (elasticsearch policy names contain 'error')
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|adding ingest pipeline" # false positive (elasticsearch ingest pipeline names contain 'error') EXCLUDED_ERRORS="$EXCLUDED_ERRORS|adding ingest pipeline" # false positive (elasticsearch ingest pipeline names contain 'error')
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating index template" # false positive (elasticsearch index or template names contain 'error') EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating index template" # false positive (elasticsearch index or template names contain 'error')
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating component template" # false positive (elasticsearch index or template names contain 'error') EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating component template" # false positive (elasticsearch index or template names contain 'error')
@@ -179,6 +180,7 @@ if [[ $EXCLUDE_FALSE_POSITIVE_ERRORS == 'Y' ]]; then
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|Static assets preprocessor only supports GET and HEAD requests" # expected WARN log lines indicating invalid auth header EXCLUDED_ERRORS="$EXCLUDED_ERRORS|Static assets preprocessor only supports GET and HEAD requests" # expected WARN log lines indicating invalid auth header
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|respondError" # respondError is a function name, output via http middleware as standard request logging EXCLUDED_ERRORS="$EXCLUDED_ERRORS|respondError" # respondError is a function name, output via http middleware as standard request logging
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|GET /kibana/" # Ignore Kibana queries with triggered words EXCLUDED_ERRORS="$EXCLUDED_ERRORS|GET /kibana/" # Ignore Kibana queries with triggered words
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|error-logs" # Elastic indexes can contain error-logs in their names, which can trigger false positives in log checks
fi fi
if [[ $EXCLUDE_KNOWN_ERRORS == 'Y' ]]; then if [[ $EXCLUDE_KNOWN_ERRORS == 'Y' ]]; then
+4 -1
View File
@@ -17,7 +17,10 @@ elasticsearch:
global: True global: True
advanced: True advanced: True
esheap: esheap:
description: Specify the memory heap size in (m)egabytes for Elasticsearch. description: Heap size to use for Elasticsearch, as a number followed by k (kilobytes), m (megabytes) or g (gigabytes), such as 600m.
forcedType: string
regex: ^[1-9][0-9]*[kKmMgG]$
regexFailureMessage: Must be a whole number followed by k, m or g, such as 600m.
helpLink: elasticsearch helpLink: elasticsearch
index_clean: index_clean:
description: Determines if indices should be considered for deletion by available disk space in the cluster. Otherwise, data is retained by the configured lifecycle settings. This setting only applies to EVAL, STANDALONE, and HEAVY NODE installations. Other installations use lifecycle settings only. description: Determines if indices should be considered for deletion by available disk space in the cluster. Otherwise, data is retained by the configured lifecycle settings. This setting only applies to EVAL, STANDALONE, and HEAVY NODE installations. Other installations use lifecycle settings only.
+5 -2
View File
@@ -403,8 +403,11 @@ logstash:
custom8: *pipeline_settings custom8: *pipeline_settings
custom9: *pipeline_settings custom9: *pipeline_settings
settings: settings:
lsheap: lsheap:
description: Heap size to use for logstash description: Heap size to use for Logstash, as a number followed by k (kilobytes), m (megabytes) or g (gigabytes), such as 500m.
forcedType: string
regex: ^[1-9][0-9]*[kKmMgG]$
regexFailureMessage: Must be a whole number followed by k, m or g, such as 500m.
helpLink: logstash helpLink: logstash
global: False global: False
config: config:
@@ -20,11 +20,17 @@ CRITICAL_AGENTS_FILE="/opt/so/conf/agents/critical-agents.txt"
OFFLINE_THRESHOLD_HOURS={{ OFFLINE_THRESHOLD_HOURS }} OFFLINE_THRESHOLD_HOURS={{ OFFLINE_THRESHOLD_HOURS }}
REALERT_THRESHOLD={{ REALERT_THRESHOLD }} REALERT_THRESHOLD={{ REALERT_THRESHOLD }}
PAGE_SIZE="{{ PAGE_SIZE }}" PAGE_SIZE="{{ PAGE_SIZE }}"
# Safety limit on pagination loops; Fleet page-based results are also capped at 10000 agents.
MAX_PAGES=100
log_message() { log_message() {
local level="$1" local level="$1"
local message="$2" local message="$2"
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") [$level] $message" >&2 echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") [$level] $message" >&2
# ERROR also goes to syslog: cron output is not monitored, and syslog is shipped to Elasticsearch.
if [ "$level" = "ERROR" ]; then
logger -t so-elastic-agent-monitor -p user.err -- "ERROR: $message" 2>/dev/null || true
fi
} }
matches_critical_pattern() { matches_critical_pattern() {
@@ -135,42 +141,70 @@ main() {
local page=1 local page=1
local total_agents=0 local total_agents=0
local processed_agents=0 local processed_agents=0
local agents_in_page=0
local agents=()
local current_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") local current_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
{%- if CUSTOM_KQUERY != None and CUSTOM_KQUERY | length > 0 %} {%- if CUSTOM_KQUERY != None and CUSTOM_KQUERY | length > 0 %}
log_message "INFO" "Using custom kquery: {{ CUSTOM_KQUERY }}" log_message "INFO" "Using custom kquery: {{ CUSTOM_KQUERY }}"
FLEET_QUERY="${FLEET_API}?kuery={{ CUSTOM_KQUERY | urlencode }}&perPage=${PAGE_SIZE}&page=${page}" FLEET_QUERY="${FLEET_API}?kuery={{ CUSTOM_KQUERY | urlencode }}&perPage=${PAGE_SIZE}"
{%- else %} {%- else %}
log_message "INFO" "Using default query (all offline or degraded agents)" log_message "INFO" "Using default query (all offline or degraded agents)"
FLEET_QUERY="${FLEET_API}?kuery=status%3Aoffline%20OR%20status%3Adegraded&perPage=${PAGE_SIZE}&page=${page}" FLEET_QUERY="${FLEET_API}?kuery=status%3Aoffline%20OR%20status%3Adegraded&perPage=${PAGE_SIZE}"
{%- endif %} {%- endif %}
while true; do while true; do
if (( page * PAGE_SIZE > 10000 )); then
log_message "ERROR" "Fleet page-based results are limited to 10000 agents (page $page x page_size $PAGE_SIZE); $processed_agents of $total_agents agents were checked. Narrow the agents being monitored with custom_kquery under Administration -> Configuration -> manager -> agent_monitoring -> config (enable 'Show advanced settings')."
exit 1
fi
log_message "INFO" "Fetching page $page (${PAGE_SIZE} agents per page)" log_message "INFO" "Fetching page $page (${PAGE_SIZE} agents per page)"
if ! response_body=$(curl -K "$CURL_CONFIG" \ if ! response_body=$(curl -K "$CURL_CONFIG" \
-s --fail \ -s --fail \
"$FLEET_QUERY" \ "${FLEET_QUERY}&page=${page}" \
-H 'kbn-xsrf: true' 2>/dev/null); then -H 'kbn-xsrf: true' 2>/dev/null); then
log_message "ERROR" "Failed to query Fleet API (page $page)" log_message "ERROR" "Failed to query Fleet API (page $page)"
exit 1 exit 1
fi fi
# pagination info # Validate the response before parsing it so a bad response can never be
current_total=$(echo "$response_body" | jq -r '.total // 0') # mistaken for an empty page.
current_page=$(echo "$response_body" | jq -r '.page // 1') if ! echo "$response_body" | jq -e 'type == "object"' >/dev/null 2>&1; then
agents_in_page=$(echo "$response_body" | jq -r '.list | length') log_message "ERROR" "Malformed Fleet API response on page $page: not a valid JSON object"
exit 1
fi
# Update total if ! current_total=$(echo "$response_body" | jq -e '.total | select(type == "number" and . >= 0 and . == floor)' 2>/dev/null); then
log_message "ERROR" "Malformed Fleet API response on page $page: missing or invalid total"
exit 1
fi
# Fleet 9.x returns agents under "items"; older responses used "list".
if ! agents_json=$(echo "$response_body" | jq -c '(.items // .list) | if type == "array" then .[] else error("no agent array") end' 2>/dev/null); then
log_message "ERROR" "Malformed Fleet API response on page $page: missing or invalid agent collection (items/list)"
exit 1
fi
# Use the latest page's total: agents changing status between pages
# (e.g. coming back online) shrink the offline/degraded result set.
total_agents="$current_total"
if [ "$page" -eq 1 ]; then if [ "$page" -eq 1 ]; then
total_agents="$current_total"
log_message "INFO" "Found $total_agents total agents across all pages" log_message "INFO" "Found $total_agents total agents across all pages"
fi fi
log_message "INFO" "Processing page $current_page with $agents_in_page agents"
# Process agents from current page # Process agents from current page
mapfile -t agents < <(echo "$response_body" | jq -c '.list[]') agents=()
agents_in_page=0
if [ -n "$agents_json" ]; then
while IFS= read -r agent; do
agents+=("$agent")
agents_in_page=$((agents_in_page + 1))
done <<< "$agents_json"
fi
log_message "INFO" "Processing page $page with $agents_in_page agents"
for agent in "${agents[@]}"; do for agent in "${agents[@]}"; do
# Grab agent details # Grab agent details
@@ -234,17 +268,20 @@ main() {
processed_agents=$((processed_agents + agents_in_page)) processed_agents=$((processed_agents + agents_in_page))
if [ "$agents_in_page" -eq 0 ] || [ "$processed_agents" -ge "$total_agents" ]; then if [ "$processed_agents" -ge "$total_agents" ]; then
log_message "INFO" "Completed processing all pages. Total processed: $processed_agents agents"
break break
fi fi
if [ "$agents_in_page" -eq 0 ]; then
log_message "ERROR" "Incomplete agent scan: page $page was empty after $processed_agents of $total_agents agents"
exit 1
fi
page=$((page + 1)) page=$((page + 1))
# Limit pagination loops incase of any issues. If agent count is high enough increase page_size in SOC manager.agent_monitoring.config.page_size if [ "$page" -gt "$MAX_PAGES" ]; then
if [ "$page" -gt 100 ]; then log_message "ERROR" "Reached maximum page limit ($MAX_PAGES) after $processed_agents of $total_agents agents. Issue with script or extremely large fleet deployment. Consider increasing page_size under Administration -> Configuration -> manager -> agent_monitoring -> config -> page_size (enable 'Show advanced settings')."
log_message "ERROR" "Reached maximum page limit (100). Issue with script or extremely large fleet deployment. Consider increasing page_size in SOC -> manager.agent_monitoring.config.page_size" exit 1
break
fi fi
done done
+55
View File
@@ -2557,6 +2557,61 @@ soc:
grid: grid:
maxUploadSize: 26214400 maxUploadSize: 26214400
staleMetricsMs: 120000 staleMetricsMs: 120000
recommendedAlarms:
- name: Root Disk Usage
metric: disk
metricKey: disk_used_root
operator: gt
threshold: '95'
durationSeconds: 300
severity: critical
clearedSeverity: info
enabled: true
- name: NSM Disk Usage
metric: disk
metricKey: disk_used_nsm
operator: gt
threshold: '95'
durationSeconds: 300
severity: critical
clearedSeverity: info
enabled: true
- name: Low PCAP Retention
metric: pcap_retention
metricKey: pcap_retention
operator: lt
threshold: '1'
durationSeconds: 300
severity: critical
clearedSeverity: info
enabled: true
- name: Suricata Packet Loss
metric: loss
metricKey: suricata_loss
operator: gt
threshold: '5'
durationSeconds: 300
severity: critical
clearedSeverity: info
enabled: true
- name: Zeek Packet Loss
metric: loss
metricKey: zeek_loss
operator: gt
threshold: '5'
durationSeconds: 300
severity: critical
clearedSeverity: info
enabled: true
- name: Low Monitor Traffic
metric: net
metricKey: traffic_mon_in
operator: lt
threshold: '5'
durationSeconds: 300
severity: critical
clearedSeverity: info
enabled: true
cases: cases:
advanced: false advanced: false
aggregationActionsEnabled: false aggregationActionsEnabled: false
+63
View File
@@ -1343,6 +1343,69 @@ soc:
staleMetricsMs: staleMetricsMs:
description: The age in milliseconds of node metrics when they are considered stale. Stale metrics have a faded appearance on the Grid screen. description: The age in milliseconds of node metrics when they are considered stale. Stale metrics have a faded appearance on the Grid screen.
global: True global: True
recommendedAlarms:
description: Recommended alarms offered on the Grid page's Alarms tab and Options dialog.
global: True
advanced: True
forcedType: "[]{}"
syntax: json
helpLink: grid
uiElements:
- field: name
label: Name
required: True
- field: metric
label: Metric
required: True
- field: metricKey
label: Metric Key
required: False
- field: operator
label: Operator
required: True
options:
- gt
- gte
- lt
- lte
- eq
- ne
- contains
- field: threshold
label: Threshold
required: True
forcedType: string
- field: durationSeconds
label: Duration Seconds
required: False
forcedType: int
- field: severity
label: Severity
required: True
options:
- critical
- high
- medium
- low
- info
- field: clearedSeverity
label: Cleared Severity
required: False
options:
- none
- critical
- high
- medium
- low
- info
- field: enabled
label: Enabled
required: False
forcedType: bool
- field: note
label: Note
required: False
multiline: True
case: case:
analyzerNodeId: analyzerNodeId:
description: The node ID on which analyzers will be executed. description: The node ID on which analyzers will be executed.