elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.72k stars 8.13k forks source link

[Security Solution] Impossible to add a runtime field for `winlog.event_data.ServiceFilename` #181016

Open maximpn opened 5 months ago

maximpn commented 5 months ago

Summary

Alerts table doesn't provide a way to filter by fields without mappings, e.g. winlog.event_data.ServiceFilename. At the same time it doesn't allow to add a runtime field for winlog.event_data.ServiceFilename complaining that this field exists.

Runtime field is required to filter out or search for alerts.

Steps to reproduce

POST /logs-test-1/_doc
{
  "@timestamp": 1713346225559,
  "event": {
    "kind": "event",
    "category": "iam",
    "type": ["group", "info"]
  },
  "winlog": {
    "event_data": {
      "ServiceFilename": "abc"
    }
  }
}

ER: It's possible to create a runtime field for winlog.event_data.ServiceFilename. AR: Errors appear.

image

def source = doc['winlog.event_data.ServiceFilename'].value;

if (source != "") {
  emit(source);
} else {
  emit("None");
}

leads to No field found for [winlog.event_data.ServiceFilename] in mapping.

image

UPDATE: The following script allows to create a runtime field

if (params._source.containsKey("winlog") && params._source["winlog"].containsKey("event_data") && params._source["winlog"]["event_data"].containsKey("ServiceFilename")) {
    emit(params._source["winlog"]["event_data"]["ServiceFilename"]);
}

Additional notes

It's possible to add runtime mapping for winlog.event_data.ServiceFilename on a clear instance. In the other words until some data appears in Security Data View which maps to .alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*.

In this case filtering at Alerts table works.

image

elasticmachine commented 5 months ago

Pinging @elastic/security-detections-response (Team:Detections and Resp)

elasticmachine commented 5 months ago

Pinging @elastic/security-solution (Team: SecuritySolution)

elasticmachine commented 5 months ago

Pinging @elastic/security-detection-engine (Team:Detection Engine)

yctercero commented 3 weeks ago

We're working on determining a good UX for supporting unmapped alert index fields. Added this ticket to the relevant epic.