feat: SERVER_DISPLAY_NAME в SAC host.display_name (sac-client 1.2.6-SAC)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+4
-1
@@ -1,5 +1,5 @@
|
|||||||
# SAC client for ssh-monitor (source from ssh-monitor)
|
# SAC client for ssh-monitor (source from ssh-monitor)
|
||||||
# SAC client release: 1.2.5-SAC — ingest HTTP 201/409/202
|
# SAC client release: 1.2.6-SAC — host.display_name from SERVER_DISPLAY_NAME
|
||||||
# shellcheck shell=bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
sac_normalize_mode() {
|
sac_normalize_mode() {
|
||||||
@@ -228,6 +228,7 @@ sac_send_event() {
|
|||||||
SAC_DETAILS_JSON="$details_json" \
|
SAC_DETAILS_JSON="$details_json" \
|
||||||
SAC_AGENT_ID="$(sac_agent_instance_id)" \
|
SAC_AGENT_ID="$(sac_agent_instance_id)" \
|
||||||
SAC_PRODUCT_VERSION="${SSH_MONITOR_VERSION:-unknown}" \
|
SAC_PRODUCT_VERSION="${SSH_MONITOR_VERSION:-unknown}" \
|
||||||
|
SAC_SERVER_DISPLAY_NAME="${SERVER_DISPLAY_NAME:-}" \
|
||||||
python3 <<'PY'
|
python3 <<'PY'
|
||||||
import json, os, socket, uuid
|
import json, os, socket, uuid
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
@@ -239,6 +240,7 @@ def details():
|
|||||||
return json.loads(raw)
|
return json.loads(raw)
|
||||||
|
|
||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
|
display = os.environ.get("SAC_SERVER_DISPLAY_NAME", "").strip()
|
||||||
etype = os.environ["SAC_EVENT_TYPE"]
|
etype = os.environ["SAC_EVENT_TYPE"]
|
||||||
if etype.startswith(("ssh.", "auth.", "rdp.")):
|
if etype.startswith(("ssh.", "auth.", "rdp.")):
|
||||||
category = "auth"
|
category = "auth"
|
||||||
@@ -264,6 +266,7 @@ payload = {
|
|||||||
"host": {
|
"host": {
|
||||||
"hostname": host,
|
"hostname": host,
|
||||||
"os_family": "linux",
|
"os_family": "linux",
|
||||||
|
**({"display_name": display} if display else {}),
|
||||||
},
|
},
|
||||||
"category": category,
|
"category": category,
|
||||||
"type": os.environ["SAC_EVENT_TYPE"],
|
"type": os.environ["SAC_EVENT_TYPE"],
|
||||||
|
|||||||
Reference in New Issue
Block a user