Skip to content

Commit 1acfa77

Browse files
crowdstrike: parse command line to populate process name in FDR logs (#15646)
This handles a special case occurs in Linux-based containerized environments when the "runc" process clones itself to get into its own namespace. The child process would have its executable path set to "/" which was resulting in "process.name" being empty. This change adds command line parsing to extract "process.name" when "process.executable" is set to a slash ("/"). Adds fields definition for ChangeTime, OciContainerId and RootPath.
1 parent e65e5d7 commit 1acfa77

File tree

7 files changed

+218
-1
lines changed

7 files changed

+218
-1
lines changed

packages/crowdstrike/changelog.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# newer versions go on top
2+
- version: "2.6.0"
3+
changes:
4+
- description: Add a fallback parsing command_line to populate the process name in the FDR data stream.
5+
type: enhancement
6+
link: https://github.com/elastic/integrations/pull/15646
27
- version: "2.5.2"
38
changes:
49
- description: Add `event.category` and `event.type` fields to process data in alerts.

packages/crowdstrike/data_stream/fdr/_dev/test/pipeline/test-linux.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
{"event_simpleName":"CriticalFileAccessed","ContextTimeStamp":"1757157936.727","GID":"0","ConfigStateHash":"1061106086","ContextProcessId":"1096090950008222800","ContextThreadId":"0","aip":"89.160.20.128","ConfigBuild":"2c8b.2.3366c72.4f","UID":"0","event_platform":"Lin","UnixMode":"61960","Entitlements":"26","name":"1532ae7e2a105adcc6ddbcf67","EventOrigin":"1","id":"01a3b1d4aa10d5329aef78ba9d3ec56f6d97","EffectiveTransmissionClass":"2","aid":"37b562b807a27cfb58dda71ec9a7eb22","timestamp":"1743508799999","cid":"4092825518eaf67377a6e4492ae44577","TargetFileName":"/812/0bb09d"}
33
{"CapPrm":"3800192030037","ParentProcessId":"8081349242194000050","SourceProcessId":"8081349242194000050","aip":"81.2.69.192","SessionProcessId":"4102020000109002000","SyntheticPR2Flags":"4","event_platform":"Lin","ProcessEndTime":"1745972888.297","SVUID":"0","EventOrigin":"45","id":"fb9bd5f0314e46ce785f479aed8f3032fcd9","EffectiveTransmissionClass":"2","timestamp":"1743508799999","ProcessGroupId":"7001610480104066706","event_simpleName":"SyntheticProcessRollup2","RawProcessId":"8905032","ContextTimeStamp":"1752350302.359","GID":"0","ConfigStateHash":"5001020160","SVGID":"0","ConfigBuild":"2c8b.2.3366c72.4f","UID":"0","CommandLine":"e7f8eac7d","TargetProcessId":"6059002040716020903","ImageFileName":"/501e","RGID":"0","SourceThreadId":"0","Entitlements":"56","name":"4f32166a22f49735247598b45006","ProcessStartTime":"1745953229.264","RUID":"0","aid":"8c687fb6b1e8231200c77ef5e3175d0e","cid":"4092825518eaf67377a6e4492ae44577"}
44
{"event_simpleName":"TerminateProcess","RawProcessId":"1070050","ContextTimeStamp":"1751300030.984","ConfigStateHash":"8001020160","ContextProcessId":"9960000700989070560","ContextThreadId":"0","aip":"89.160.20.128","ConfigBuild":"2c8b.2.3366c72.4f","event_platform":"Lin","TargetProcessId":"6960000700989070560","Entitlements":"36","name":"6b1c662a760f5ed9750d4","EventOrigin":"1","id":"3e71b26395f4386bcb6602ee6777bb5f3124","EffectiveTransmissionClass":"2","aid":"12111f24f25a2a99438b40765c236577","timestamp":"1743508799999","cid":"4092825518eaf67377a6e4492ae44577"}
5+
{"ChangeTime":"1731329600.968","OciContainerId":"sw345tf5e3455r7dw32w23t6t7fde34ed345rfe45rf0ew4fd","CapPrm":"123438954321","ParentProcessId":"12347782548906","SourceProcessId":"12347782548906","aip":"89.160.20.128","SessionProcessId":"1234915117961","SHA1HashData":"0000000000000000000000000000000000000000","event_platform":"Lin","ProcessEndTime":"1760406073.595","SVUID":"0","ParentBaseFileName":"runc","EventOrigin":"17","id":"1w23e4r-d03e-4003-bc75-71c6e819ca5f","EffectiveTransmissionClass":"2","Tags":"874, 17179870274, 12094627905582, 12094627906234, 212205744162400","timestamp":"1760406074201","ProcessGroupId":"1234915117961","LocalAddressIP4":"0.0.0.0","event_simpleName":"ProcessRollup2","RawProcessId":"1234","RootPath":"/","GID":"0","ConfigStateHash":"1026580567","UserName":"root","SVGID":"0","MD5HashData":"88922d50263b059696c2af5a99906562","SHA256HashData":"d4ff1c438e330777002332a305fcf965cfaa7d0dbeb899293d347298cbf6d4b6","ConfigBuild":"1007.4.0013701.1","UID":"0","CommandLine":"runc init","TargetProcessId":"12347783237538","ImageFileName":"/","RGID":"0","SourceThreadId":"0","Entitlements":"15","name":"ProcessRollup2LinV12","RUID":"0","ProcessStartTime":"1760406073.568","ComputerName":"comp2","aid":"ffffffff62714a708030d494ca0a7e60","cid":"ffffffff15754bcfb5f9152ec7ac90ac"}

packages/crowdstrike/data_stream/fdr/_dev/test/pipeline/test-linux.log-expected.json

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,170 @@
387387
"tags": [
388388
"preserve_original_event"
389389
]
390+
},
391+
{
392+
"@timestamp": "2025-10-14T01:41:14.201Z",
393+
"crowdstrike": {
394+
"CapPrm": "123438954321",
395+
"ChangeTime": "2024-11-11T12:53:20.968Z",
396+
"ConfigStateHash": "1026580567",
397+
"EffectiveTransmissionClass": "2",
398+
"Entitlements": "15",
399+
"EventOrigin": "17",
400+
"LocalAddressIP4": [
401+
"0.0.0.0"
402+
],
403+
"MD5HashData": "88922d50263b059696c2af5a99906562",
404+
"OciContainerId": "sw345tf5e3455r7dw32w23t6t7fde34ed345rfe45rf0ew4fd",
405+
"RGID": "0",
406+
"RUID": "0",
407+
"RootPath": "/",
408+
"SHA256HashData": "d4ff1c438e330777002332a305fcf965cfaa7d0dbeb899293d347298cbf6d4b6",
409+
"SVGID": "0",
410+
"SVUID": "0",
411+
"SessionProcessId": "1234915117961",
412+
"SourceProcessId": "12347782548906",
413+
"SourceThreadId": "0",
414+
"Tags": [
415+
"874",
416+
"17179870274",
417+
"12094627905582",
418+
"12094627906234",
419+
"212205744162400"
420+
],
421+
"cid": "ffffffff15754bcfb5f9152ec7ac90ac",
422+
"id": "1w23e4r-d03e-4003-bc75-71c6e819ca5f",
423+
"name": "ProcessRollup2LinV12"
424+
},
425+
"device": {
426+
"id": "ffffffff62714a708030d494ca0a7e60"
427+
},
428+
"event": {
429+
"action": "ProcessRollup2",
430+
"category": [
431+
"process"
432+
],
433+
"created": "2025-10-14T01:41:14.201Z",
434+
"id": "1w23e4r-d03e-4003-bc75-71c6e819ca5f|ffffffff62714a708030d494ca0a7e60|ffffffff15754bcfb5f9152ec7ac90ac",
435+
"kind": "event",
436+
"original": "{\"ChangeTime\":\"1731329600.968\",\"OciContainerId\":\"sw345tf5e3455r7dw32w23t6t7fde34ed345rfe45rf0ew4fd\",\"CapPrm\":\"123438954321\",\"ParentProcessId\":\"12347782548906\",\"SourceProcessId\":\"12347782548906\",\"aip\":\"89.160.20.128\",\"SessionProcessId\":\"1234915117961\",\"SHA1HashData\":\"0000000000000000000000000000000000000000\",\"event_platform\":\"Lin\",\"ProcessEndTime\":\"1760406073.595\",\"SVUID\":\"0\",\"ParentBaseFileName\":\"runc\",\"EventOrigin\":\"17\",\"id\":\"1w23e4r-d03e-4003-bc75-71c6e819ca5f\",\"EffectiveTransmissionClass\":\"2\",\"Tags\":\"874, 17179870274, 12094627905582, 12094627906234, 212205744162400\",\"timestamp\":\"1760406074201\",\"ProcessGroupId\":\"1234915117961\",\"LocalAddressIP4\":\"0.0.0.0\",\"event_simpleName\":\"ProcessRollup2\",\"RawProcessId\":\"1234\",\"RootPath\":\"/\",\"GID\":\"0\",\"ConfigStateHash\":\"1026580567\",\"UserName\":\"root\",\"SVGID\":\"0\",\"MD5HashData\":\"88922d50263b059696c2af5a99906562\",\"SHA256HashData\":\"d4ff1c438e330777002332a305fcf965cfaa7d0dbeb899293d347298cbf6d4b6\",\"ConfigBuild\":\"1007.4.0013701.1\",\"UID\":\"0\",\"CommandLine\":\"runc init\",\"TargetProcessId\":\"12347783237538\",\"ImageFileName\":\"/\",\"RGID\":\"0\",\"SourceThreadId\":\"0\",\"Entitlements\":\"15\",\"name\":\"ProcessRollup2LinV12\",\"RUID\":\"0\",\"ProcessStartTime\":\"1760406073.568\",\"ComputerName\":\"comp2\",\"aid\":\"ffffffff62714a708030d494ca0a7e60\",\"cid\":\"ffffffff15754bcfb5f9152ec7ac90ac\"}",
437+
"outcome": "success",
438+
"type": [
439+
"start"
440+
]
441+
},
442+
"group": {
443+
"Ext": {
444+
"real": {
445+
"id": "0"
446+
}
447+
},
448+
"id": "0"
449+
},
450+
"host": {
451+
"hostname": "comp2",
452+
"id": "ffffffff62714a708030d494ca0a7e60",
453+
"name": "comp2",
454+
"os": {
455+
"type": "linux"
456+
}
457+
},
458+
"message": "ProcessRollup2",
459+
"observer": {
460+
"address": [
461+
"89.160.20.128"
462+
],
463+
"geo": {
464+
"city_name": "Linköping",
465+
"continent_name": "Europe",
466+
"country_iso_code": "SE",
467+
"country_name": "Sweden",
468+
"location": {
469+
"lat": 58.4167,
470+
"lon": 15.6167
471+
},
472+
"region_iso_code": "SE-E",
473+
"region_name": "Östergötland County"
474+
},
475+
"ip": [
476+
"89.160.20.128"
477+
],
478+
"serial_number": "ffffffff62714a708030d494ca0a7e60",
479+
"version": "1007.4.0013701.1"
480+
},
481+
"process": {
482+
"args": [
483+
"runc",
484+
"init"
485+
],
486+
"args_count": 2,
487+
"command_line": "runc init",
488+
"end": "2025-10-14T01:41:13.595Z",
489+
"entity_id": "12347783237538",
490+
"executable": "/",
491+
"group": {
492+
"id": "0"
493+
},
494+
"group_leader": {
495+
"entity_id": "1234915117961"
496+
},
497+
"hash": {
498+
"md5": "88922d50263b059696c2af5a99906562",
499+
"sha256": "d4ff1c438e330777002332a305fcf965cfaa7d0dbeb899293d347298cbf6d4b6"
500+
},
501+
"name": "runc",
502+
"parent": {
503+
"entity_id": "12347782548906",
504+
"name": "runc"
505+
},
506+
"pgid": 1234915117961,
507+
"pid": 1234,
508+
"real_group": {
509+
"id": "0"
510+
},
511+
"real_user": {
512+
"id": "0"
513+
},
514+
"start": "2025-10-14T01:41:13.568Z",
515+
"uptime": 0
516+
},
517+
"related": {
518+
"hash": [
519+
"88922d50263b059696c2af5a99906562",
520+
"d4ff1c438e330777002332a305fcf965cfaa7d0dbeb899293d347298cbf6d4b6",
521+
"1026580567"
522+
],
523+
"hosts": [
524+
"comp2"
525+
],
526+
"ip": [
527+
"89.160.20.128",
528+
"0.0.0.0"
529+
],
530+
"user": [
531+
"root",
532+
"0"
533+
]
534+
},
535+
"source": {
536+
"address": "0.0.0.0",
537+
"ip": "0.0.0.0"
538+
},
539+
"tags": [
540+
"preserve_original_event"
541+
],
542+
"user": {
543+
"Ext": {
544+
"real": {
545+
"id": "0"
546+
}
547+
},
548+
"group": {
549+
"id": "0"
550+
},
551+
"id": "0",
552+
"name": "root"
553+
}
390554
}
391555
]
392556
}

packages/crowdstrike/data_stream/fdr/elasticsearch/ingest_pipeline/default.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ processors:
240240
- append:
241241
field: error.message
242242
value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.pipeline}}} failed with message: {{{_ingest.on_failure_message}}}'
243+
- date:
244+
tag: date-change-time
245+
field: crowdstrike.ChangeTime
246+
target_field: crowdstrike.ChangeTime
247+
formats:
248+
- UNIX
249+
if: >
250+
ctx.crowdstrike?.ChangeTime != null &&
251+
ctx.crowdstrike.ChangeTime != ""
252+
on_failure:
253+
- remove:
254+
field: crowdstrike.ChangeTime
255+
ignore_failure: true
256+
- append:
257+
field: error.message
258+
value: 'Processor {{{_ingest.on_failure_processor_type}}} with tag {{{_ingest.on_failure_processor_tag}}} in pipeline {{{_ingest.pipeline}}} failed with message: {{{_ingest.on_failure_message}}}'
243259
- rename:
244260
tag: rename-message
245261
field: crowdstrike.message
@@ -2059,6 +2075,28 @@ processors:
20592075
name = executable.splitOnToken("/")[-1];
20602076
}
20612077
ctx.process.put("name", name);
2078+
2079+
# This handles a special case occurs in Linux-based containerized environments
2080+
# when the "runc" process clones itself to get into its own namespace.
2081+
# The child process would have its executable path set to "/"
2082+
# and consequently, the process name would not be set.
2083+
# For more details, see https://terenceli.github.io/%E6%8A%80%E6%9C%AF/2021/12/28/runc-internals-3.
2084+
- script:
2085+
tag: parse_process_name_from_command_line
2086+
description: Extract process.name from command line if not already present.
2087+
lang: painless
2088+
if: >-
2089+
ctx.process?.executable == '/' &&
2090+
(ctx.process.name == null || ctx.process.name == '') &&
2091+
(ctx.process.args instanceof List && ctx.process.args.length > 0)
2092+
source: |-
2093+
ctx.process.name = ctx.process.args[0];
2094+
2095+
// Clean up path separators.
2096+
int lastSlash = ctx.process.name.lastIndexOf("/");
2097+
if (lastSlash != -1) {
2098+
ctx.process.name = ctx.process.name.substring(lastSlash + 1);
2099+
}
20622100
- convert:
20632101
field: crowdstrike.ExitCode
20642102
type: long

packages/crowdstrike/data_stream/fdr/fields/fields.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@
170170
type: version
171171
- name: ChangedPcrBitmap
172172
type: match_only_text
173+
- name: ChangeTime
174+
type: date
173175
- name: ChannelDiffStatus
174176
type: keyword
175177
- name: ChannelId
@@ -921,6 +923,8 @@
921923
type: match_only_text
922924
- name: OciContainerHostConfigReadOnlyRootfs
923925
type: match_only_text
926+
- name: OciContainerId
927+
type: match_only_text
924928
- name: OciContainerImageId
925929
type: match_only_text
926930
- name: OciContainerInfoRetransmitted
@@ -1207,6 +1211,8 @@
12071211
type: keyword
12081212
- name: RGID
12091213
type: keyword
1214+
- name: RootPath
1215+
type: keyword
12101216
- name: RouteAge
12111217
type: keyword
12121218
- name: RouteMetric

packages/crowdstrike/docs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,6 +1480,7 @@ If the severity name is not available from the original document, it is determin
14801480
| crowdstrike.CertificatePublisher | | keyword |
14811481
| crowdstrike.CertificateSignatureHash | | keyword |
14821482
| crowdstrike.CertificateSignatureHashAlgorithm | | keyword |
1483+
| crowdstrike.ChangeTime | | date |
14831484
| crowdstrike.ChangedPcrBitmap | | match_only_text |
14841485
| crowdstrike.ChannelDiffStatus | | keyword |
14851486
| crowdstrike.ChannelId | | keyword |
@@ -1839,6 +1840,7 @@ If the severity name is not available from the original document, it is determin
18391840
| crowdstrike.OciContainerHostConfigPrivileged | | match_only_text |
18401841
| crowdstrike.OciContainerHostConfigPublishAllPorts | | match_only_text |
18411842
| crowdstrike.OciContainerHostConfigReadOnlyRootfs | | match_only_text |
1843+
| crowdstrike.OciContainerId | | match_only_text |
18421844
| crowdstrike.OciContainerImageId | | match_only_text |
18431845
| crowdstrike.OciContainerInfoRetransmitted | | match_only_text |
18441846
| crowdstrike.OciContainerMounts | | match_only_text |
@@ -2001,6 +2003,7 @@ If the severity name is not available from the original document, it is determin
20012003
| crowdstrike.ResendToCloud | | keyword |
20022004
| crowdstrike.RespondingDnsServer | | keyword |
20032005
| crowdstrike.RetransmitTime | | keyword |
2006+
| crowdstrike.RootPath | | keyword |
20042007
| crowdstrike.RouteAge | | keyword |
20052008
| crowdstrike.RouteMetric | | keyword |
20062009
| crowdstrike.RouteOrigin | | keyword |

packages/crowdstrike/manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: crowdstrike
22
title: CrowdStrike
3-
version: "2.5.2"
3+
version: "2.6.0"
44
description: Collect logs from Crowdstrike with Elastic Agent.
55
type: integration
66
format_version: "3.4.0"

0 commit comments

Comments
 (0)