Loading...
Loading...
Compare original and translation side by side
data_stream/<stream>/fields/ecs.ymlevent.kindevent.categoryevent.typeevent.outcometypemetric_typedimensionmulti_fieldselastic-package checkelastic-package lintdata_stream/<stream>/fields/ecs.ymlevent.kindevent.categoryevent.typeevent.outcometypemetric_typedimensionmulti_fieldselastic-package checkelastic-package lint_dev/build/build.ymldependencies:
ecs:
reference: "git@v9.3.0"field "destination.ip" is undefined_dev/build/build.ymldependencies:
ecs:
reference: "git@v9.3.0"field "destination.ip" is undefinedfields/fields/base-fields.ymlbase-fields.yml@timestampexternal: ecstypevalueconstant_keyword- name: data_stream.type
external: ecs
- name: data_stream.dataset
external: ecs
- name: data_stream.namespace
external: ecs
- name: event.module
external: ecs
type: constant_keyword
value: <package_name>
- name: event.dataset
external: ecs
type: constant_keyword
value: <package_name>.<stream_name>
- name: '@timestamp'
external: ecs@timestampbase-fields.yml@timestampexternal: ecsconstant_keywordtypevalue- name: data_stream.type
external: ecs
- name: data_stream.dataset
external: ecs
- name: data_stream.namespace
external: ecs
- name: event.module
external: ecs
type: constant_keyword
value: <package_name>
- name: event.dataset
external: ecs
type: constant_keyword
value: <package_name>.<stream_name>
- name: '@timestamp'
external: ecs@timestampbase-fields.ymlconstant_keywordconstant_keywordconstant_keywordbase-fields.yml| Field | Why |
|---|---|
| One value per data stream by definition |
| One value per package |
| Fixed per stream ( |
| Fixed per stream |
| Set at deployment, constant within index |
| Package represents one vendor |
| Package represents one product |
constant_keywordobserver.vendorexternal: ecsecs.ymlbase-fields.yml- name: observer.vendor
external: ecs
type: constant_keyword
value: Acme Corpremove_from_sourceconstant_keyword_source_source.excludesconstant_keywordbase-fields.yml| 字段 | 使用 |
|---|---|
| 根据定义,每个数据流对应一个值 |
| 每个包对应一个值 |
| 每个流固定为 |
| 每个流固定不变 |
| 部署时设置,在索引内保持恒定 |
| 每个包代表一个厂商 |
| 每个包代表一个产品 |
constant_keywordobserver.vendorexternal: ecsecs.ymlbase-fields.yml- name: observer.vendor
external: ecs
type: constant_keyword
value: Acme Corpremove_from_sourceconstant_keyword_source_source.excludesecs.ymlecs.ymlnameexternal: ecs_dev/build/build.ymlexternal: ecsecs.ymlbase-fields.ymltype: constant_keywordvalue:external: ecsexternal: ecsfields.ymlagent.ymlbeats.yml- name: event.kind
external: ecs
- name: event.category
external: ecs
- name: event.type
external: ecs
- name: event.outcome
external: ecs
- name: event.action
external: ecs
- name: source.ip
external: ecs
- name: source.port
external: ecs
- name: destination.ip
external: ecs
- name: user.name
external: ecs
- name: related.ip
external: ecs
- name: related.user
external: ecsexternal: ecsecs.ymlbase-fields.yml- name: observer.vendor
external: ecs
type: constant_keyword
value: Acme Corpnameexternal: ecs_dev/build/build.ymlexternal: ecsecs.ymlbase-fields.ymlexternal: ecstype: constant_keywordvalue:fields.ymlagent.ymlbeats.ymlexternal: ecs- name: event.kind
external: ecs
- name: event.category
external: ecs
- name: event.type
external: ecs
- name: event.outcome
external: ecs
- name: event.action
external: ecs
- name: source.ip
external: ecs
- name: source.port
external: ecs
- name: destination.ip
external: ecs
- name: user.name
external: ecs
- name: related.ip
external: ecs
- name: related.user
external: ecsexternal: ecsecs.ymlbase-fields.yml- name: observer.vendor
external: ecs
type: constant_keyword
value: Acme Corpfields.ymlfields.ymlgroup- name: acme.firewall
type: group
fields:
- name: rule_id
type: keyword
- name: policy_name
type: keyword
- name: bytes_in
type: long
unit: byte
metric_type: gaugetype: objectgroupfieldsgroup- name: acme.firewall
type: group
fields:
- name: rule_id
type: keyword
- name: policy_name
type: keyword
- name: bytes_in
type: long
unit: byte
metric_type: gaugetype: objectfieldsgrouplabels.*labels.*labelstype: objectobject_type: keywordlabels.*labels.*labels.is_ioc_transform_sourcelabelstype: objectobject_type: keywordlabels.*labels.is_ioc_transform_sourcelabels.*- name: acme.firewall
type: group
fields:
- name: is_encrypted
type: boolean
- name: policy_name
type: keyword- name: acme.firewall
type: group
fields:
- name: rule
type: group
fields:
- name: id
type: keyword
- name: name
type: keyword
- name: action
type: keyword- name: acme.firewall
type: group
fields:
- name: is_encrypted
type: boolean
- name: policy_name
type: keyword- name: acme.firewall
type: group
fields:
- name: rule
type: group
fields:
- name: id
type: keyword
- name: name
type: keyword
- name: action
type: keywordagent.ymlagent.ymlcloud.image.idcloud.instance.idhost.containerizedhost.os.buildhost.os.codenameinput.typelog.offsetreferences/root-and-core-fields.mdcloud.image.idcloud.instance.idhost.containerizedhost.os.buildhost.os.codenameinput.typelog.offsetreferences/root-and-core-fields.mdbeats.ymlbeats.ymlinput.typelog.offsetlog.flagslog.file.*references/root-and-core-fields.mdinput.typelog.offsetlog.flagslog.file.*references/root-and-core-fields.mdfields.ymlfields.yml| Field | Type | Notes |
|---|---|---|
| keyword | Highest-level classification. |
| keyword[] | Broad domain buckets — always an array. |
| keyword[] | Sub-buckets within category — always an array. |
| keyword | |
event.kindalertassetenrichmenteventmetricpipeline_errorsignalstateevent.categoryapiauthenticationconfigurationdatabasedriveremailfilehostiamintrusion_detectionlibrarymalwarenetworkpackageprocessregistrysessionthreatvulnerabilitywebevent.typeaccessadminallowedchangeconnectioncreationdeletiondenieddeviceenderrorgroupindicatorinfoinstallationprotocolstartuserevent.kindeventmetricstatepipeline_erroron_failureevent.categoryevent.typeevent.outcomeevent.actionblockeddroppedauthenticatedreferences/categorization-cheatsheet.md| 字段 | 类型 | 说明 |
|---|---|---|
| keyword | 最高层级分类。 |
| keyword[] | 宽泛领域分组——始终为数组。 |
| keyword[] | 分类下的子分组——始终为数组。 |
| keyword | |
event.kindalertassetenrichmenteventmetricpipeline_errorsignalstateevent.categoryapiauthenticationconfigurationdatabasedriveremailfilehostiamintrusion_detectionlibrarymalwarenetworkpackageprocessregistrysessionthreatvulnerabilitywebevent.typeaccessadminallowedchangeconnectioncreationdeletiondenieddeviceenderrorgroupindicatorinfoinstallationprotocolstartuserevent.kindeventmetricstateon_failurepipeline_errorevent.categoryevent.typeevent.outcomeblockeddroppedauthenticatedevent.actionreferences/categorization-cheatsheet.md| Field | When to use | Set by |
|---|---|---|
| The primary event timestamp. Parse from the source event data. Required. | Integration pipeline |
| When the event was first created or recorded by the source system, if different from | Integration pipeline |
| When an activity or period began (e.g., session start, connection start). | Integration pipeline |
| When an activity or period ended (e.g., session end, connection close). | Integration pipeline |
| When the event was ingested into Elasticsearch. | Elasticsearch (outside the integration) |
event.ingestedsetevent.ingested@timestampevent.createdevent.startevent.endtype: datefields.yml| 字段 | 使用场景 | 设置方 |
|---|---|---|
| 主事件时间戳。从源事件数据中解析。必填。 | 集成管道 |
| 当事件首次被源系统创建或记录的时间与 | 集成管道 |
| 活动或周期开始的时间(例如会话开始、连接建立)。 | 集成管道 |
| 活动或周期结束的时间(例如会话结束、连接关闭)。 | 集成管道 |
| 事件被Elasticsearch摄入的时间。 | Elasticsearch(集成外部) |
event.ingestedevent.ingestedset@timestampevent.createdevent.startevent.endfields.ymltype: dategeoclient.geodestination.geohost.geoobserver.geoserver.geosource.geothreat.indicator.geogeo.*target_fieldgeoip- geoip:
field: source.ip
target_field: source.geo
ignore_missing: trueasclient.asdestination.asserver.assource.asgeoipGeoLite2-ASN.mmdbgeoipasnorganization_nameas.numberas.organization.name- geoip:
database_file: GeoLite2-ASN.mmdb
field: source.ip
target_field: source.as
properties:
- asn
- organization_name
ignore_missing: true
- rename:
field: source.as.asn
target_field: source.as.number
ignore_missing: true
- rename:
field: source.as.organization_name
target_field: source.as.organization.name
ignore_missing: trueingest-pipelinesreferences/processor-cookbook.mdoshost.osobserver.osuser_agent.osgeoclient.geodestination.geohost.geoobserver.geoserver.geosource.geothreat.indicator.geogeo.*geoiptarget_field- geoip:
field: source.ip
target_field: source.geo
ignore_missing: trueasclient.asdestination.asserver.assource.asgeoipGeoLite2-ASN.mmdbgeoipasnorganization_nameas.numberas.organization.name- geoip:
database_file: GeoLite2-ASN.mmdb
field: source.ip
target_field: source.as
properties:
- asn
- organization_name
ignore_missing: true
- rename:
field: source.as.asn
target_field: source.as.number
ignore_missing: true
- rename:
field: source.as.organization_name
target_field: source.as.organization.name
ignore_missing: trueingest-pipelinesreferences/processor-cookbook.mdoshost.osobserver.osuser_agent.ostype: nestednested| Field | Contains |
|---|---|
| |
| |
| |
| |
| |
| |
{
"email": {
"attachments": {
"file": {
"name": ["a.pdf", "b.pdf"],
"size": [1024, 2048]
}
}
}
}{
"email": {
"attachments": [
{ "file": { "name": "a.pdf", "size": 1024 } },
{ "file": { "name": "b.pdf", "size": 2048 } }
]
}
}ecs.ymlnestedexternal: ecsemail.attachments.file.name- name: email.attachments
external: ecsscriptingest-pipelinesreferences/painless-patterns.mdreferences/processor-cookbook.md- script:
tag: build_email_attachments
description: Build email.attachments as array of nested objects from parallel source arrays.
lang: painless
if: ctx.json?.file_names instanceof List && ctx.json?.file_sizes instanceof List
source: |-
def names = ctx.json.file_names;
def sizes = ctx.json.file_sizes;
int len = Math.min(names.size(), sizes.size());
def attachments = new ArrayList(len);
for (int i = 0; i < len; i++) {
def attachment = new HashMap();
def file = new HashMap();
file.put('name', names.get(i));
file.put('size', sizes.get(i));
attachment.put('file', file);
attachments.add(attachment);
}
ctx.email = ctx.email ?: [:];
ctx.email.attachments = attachments;renamesetcopy_fromemail.attachmentstype: nestednested| 字段 | 包含内容 |
|---|---|
| |
| |
| |
| |
| |
| |
{
"email": {
"attachments": {
"file": {
"name": ["a.pdf", "b.pdf"],
"size": [1024, 2048]
}
}
}
}{
"email": {
"attachments": [
{ "file": { "name": "a.pdf", "size": 1024 } },
{ "file": { "name": "b.pdf", "size": 2048 } }
]
}
}ecs.ymlexternal: ecsnestedemail.attachments.file.name- name: email.attachments
external: ecsscriptingest-pipelinesreferences/painless-patterns.mdreferences/processor-cookbook.md- script:
tag: build_email_attachments
description: Build email.attachments as array of nested objects from parallel source arrays.
lang: painless
if: ctx.json?.file_names instanceof List && ctx.json?.file_sizes instanceof List
source: |-
def names = ctx.json.file_names;
def sizes = ctx.json.file_sizes;
int len = Math.min(names.size(), sizes.size());
def attachments = new ArrayList(len);
for (int i = 0; i < len; i++) {
def attachment = new HashMap();
def file = new HashMap();
file.put('name', names.get(i));
file.put('size', sizes.get(i));
attachment.put('file', file);
attachments.add(attachment);
}
ctx.email = ctx.email ?: [:];
ctx.email.attachments = attachments;renamecopy_fromsetemail.attachmentsfields.ymlkeywordconstant_keywordlongdoublescaled_floatdatedate_nanosdate_nanosipbooleangeo_pointgroupfieldsobjectflattenednestedtextmatch_only_textkeywordmulti_fieldsmetric_typegaugecounterunitbytepercentmsdimensionreferences/mapping-type-matrix.mdfields.ymlkeywordconstant_keywordlongdoublescaled_floatdatedate_nanosdate_nanosipbooleangeo_pointgroupfieldsobjectflattenednestedtextmatch_only_textmulti_fieldskeywordmetric_typegaugecounterunitbytepercentmsdimensionreferences/mapping-type-matrix.md| Rule | DO | DON'T |
|---|---|---|
| Use snake_case | | |
| Use lowercase | | |
| No asterisks in names | | |
| Use groups for hierarchy | | |
*groupflattened| 规则 | 正确做法 | 错误做法 |
|---|---|---|
| 使用蛇形命名法 | | |
| 使用小写 | | |
| 名称中不含星号 | | |
| 使用组实现层级 | 嵌套group形式的 | 扁平点分形式的 |
*groupflattenedundefinedundefined
Pipeline expected output (`*-expected.json`) always uses nested object form regardless of how the source data represented the field. A source `"host.name": "myhost"` produces `{"host": {"name": "myhost"}}` in the output.
When source data contains literal dotted keys that Elasticsearch would otherwise expand, use `dot_expander`:
```yaml
- dot_expander:
field: "*"
override: true
管道预期输出(`*-expected.json`)始终使用嵌套对象形式,无论源数据如何表示该字段。源数据中的`"host.name": "myhost"`在输出中会变为`{"host": {"name": "myhost"}}`。
当源数据包含Elasticsearch会自动展开的字面点分键时,请使用`dot_expander`:
```yaml
- dot_expander:
field: "*"
override: truegeo_pointlatlon"source": {
"geo": {
"location": { "lat": 51.5142, "lon": -0.0931 },
"city_name": "London",
"country_iso_code": "GB"
}
}fields.ymlgeo_point*.geo.locationgeo_pointecs.ymlecs@mappingsgeo_pointlatlon"source": {
"geo": {
"location": { "lat": 51.5142, "lon": -0.0931 },
"city_name": "London",
"country_iso_code": "GB"
}
}fields.ymlgeo_pointecs@mappingsecs.yml*.geo.locationgeo_point- set:
field: event.kind
value: event
- append:
field: event.category
value: web
- append:
field: event.type
value: access- set:
field: event.kind
value: event
- append:
field: event.category
value: web
- append:
field: event.type
value: access- set:
field: event.outcome
value: success
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code < 400"
- set:
field: event.outcome
value: failure
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code >= 400"- set:
field: event.outcome
value: success
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code < 400"
- set:
field: event.outcome
value: failure
if: "ctx?.http?.response?.status_code != null && ctx.http.response.status_code >= 400"on_failure:
- set:
field: event.kind
value: pipeline_erroron_failure:
- set:
field: event.kind
value: pipeline_errorfield "destination.ip" is undefined_dev/build/build.ymldependencies.ecs.referencegit@v9.3.0ecs.ymlexternal: ecsfields.ymlexternal: ecsexternal: ecsfields.ymlfield "destination.ip" is undefined_dev/build/build.ymldependencies.ecs.referencegit@v9.3.0ecs.ymlexternal: ecsfields.ymlexternal: ecsexternal: ecsfields.yml_dev/build/build.ymldependencies.ecs.referencebuild.ymlgit@v9.3.0ecs.ymlecs.ymlexternal: ecsexternal: ecsmetric_typegeo.*event.categoryevent.typeappendsetnestedemail.attachmentsthreat.enrichmentsnested_dev/build/build.ymldependencies.ecs.referencebuild.ymlgit@v9.3.0ecs.ymlecs.ymlexternal: ecsexternal: ecsmetric_typegeo.*event.categoryevent.typeappendsetnestedemail.attachmentsthreat.enrichmentsnestedelastic-package lint
elastic-package check
elastic-package test pipeline --data-streams <stream>elastic-package lint
elastic-package check
elastic-package test pipeline --data-streams <stream>references/mapping-type-matrix.mdreferences/categorization-cheatsheet.mdreferences/root-and-core-fields.mdreferences/fieldset-links.mdreferences/mapping-type-matrix.mdreferences/categorization-cheatsheet.mdreferences/root-and-core-fields.mdreferences/fieldset-links.md