@@ -108,17 +108,24 @@ alter // Extract the <PRI> value from the syslog header
108108call esxi_event_classification
109109| call esxi_general_fields_mapping
110110| filter esxi_event_type = "Command Execution" AND _raw_log ~= "(?i)user\s+\'\w+\'\s+running\s+command\s+\'.+\'"
111- | alter // Extract fields
112- process = arrayindex(regextract(parsed_fields -> process_pid, "(.+)\["),0),
113- pid = arrayindex(regextract(parsed_fields -> process_pid, "\[(\d+)"),0),
111+ | alter // Extract fields - sshd-session is the source (initiator); the executed command is the target (CRTX-257648 model)
112+ source_process = arrayindex(regextract(parsed_fields -> process_pid, "(.+)\["),0),
113+ source_pid = arrayindex(regextract(parsed_fields -> process_pid, "\[(\d+)"),0),
114114 user_name = arrayindex(regextract(msg, "User\s+\'(\S+)\'\s+"),0),
115115 command_line = arrayindex(regextract(msg, "command\s+\'(.+)\'"),0)
116+ | alter // Derive target process from the command line (CRTX-257648: basename of first token; path = first token if it contains "/")
117+ target_first_token = arrayindex(regextract(command_line, "^(\S+)"),0)
118+ | alter
119+ target_process_name = arrayindex(regextract(target_first_token, "([^\/]+)$"),0),
120+ target_process_path = if(target_first_token ~= "\/", target_first_token, null)
116121
117122| alter // Map to XDM
118- xdm.target.host.hostname = parsed_fields -> hostname,
119- xdm.target.process.name = process,
120- xdm.target.process.pid = to_integer(pid),
121- xdm.target.user.username = user_name,
123+ xdm.source.host.hostname = parsed_fields -> hostname,
124+ xdm.source.process.name = source_process,
125+ xdm.source.process.pid = to_integer(source_pid),
126+ xdm.source.user.username = user_name,
127+ xdm.target.process.name = target_process_name,
128+ xdm.target.process.executable.path = target_process_path,
122129 xdm.target.process.command_line = command_line,
123130 xdm.event.operation = XDM_CONST.OPERATION_TYPE_EXECUTION,
124131 xdm.event.operation_sub_type = "User interactive";
@@ -127,18 +134,25 @@ call esxi_event_classification
127134call esxi_event_classification
128135| call esxi_general_fields_mapping
129136| filter esxi_event_type = "Command Execution" AND _raw_log ~= "\s+(?i)shell\[\d+\]\:\s+\[\w+\]\:\s.+"
130- | alter // Extract fields
137+ | alter // Extract fields - shell is the source; the executed command is the target (CRTX-257648 model)
131138 process = arrayindex(regextract(parsed_fields -> process_pid, "(.+)\["),0),
132139 pid = arrayindex(regextract(parsed_fields -> process_pid, "\[(\d+)"),0),
133140 user_name = arrayindex(regextract(msg, "\[(\w+)\]\:"),0),
134141 command_line = arrayindex(regextract(msg, "\[\w+\]\:\s(.+)"),0)
142+ | alter // Derive target process from the command line (CRTX-257648: basename of first token; path = first token if it contains "/")
143+ target_first_token = arrayindex(regextract(command_line, "^(\S+)"),0)
144+ | alter
145+ target_process_name = arrayindex(regextract(target_first_token, "([^\/]+)$"),0),
146+ target_process_path = if(target_first_token ~= "\/", target_first_token, null)
135147
136148| alter // Map to XDM
137149 xdm.source.host.hostname = parsed_fields -> hostname,
138150 xdm.source.process.name = process,
139151 xdm.source.process.pid = to_integer(pid),
140152 xdm.source.user.username = user_name,
141- xdm.source.process.command_line = command_line,
153+ xdm.target.process.name = target_process_name,
154+ xdm.target.process.executable.path = target_process_path,
155+ xdm.target.process.command_line = command_line,
142156 xdm.event.operation = XDM_CONST.OPERATION_TYPE_EXECUTION,
143157 xdm.event.operation_sub_type = "User interactive";
144158
@@ -165,18 +179,25 @@ call esxi_event_classification
165179call esxi_event_classification
166180| call esxi_general_fields_mapping
167181| filter esxi_event_type = "Command Execution" AND _raw_log ~= "started\s+from\s+\'\w+\'\s+\d+\s+with\s+cmdline\s+\'.+\'\,\s+parent\s+\d+"
168- | alter // Extract fields
169- process_name = arrayindex(regextract(msg, "started\s+from\s+\'(\w+)\'"),0),
170- pid = arrayindex(regextract(msg, "started\s+from\s+\'\w+\'\s+(\d+)"),0),
182+ | alter // Extract fields - vmkernel is the emitter tag only (not stored); source = spawner ("started from"), target = spawned process
183+ source_process_name = arrayindex(regextract(msg, "started\s+from\s+\'(\w+)\'"),0),
184+ target_pid = arrayindex(regextract(msg, "started\s+from\s+\'\w+\'\s+(\d+)"),0),
171185 command_line = arrayindex(regextract(msg, "with\s+cmdline\s+\'(.+)\'"),0),
172- ppid = arrayindex(regextract(msg, "parent\s+(\d+)"),0)
186+ source_pid = arrayindex(regextract(msg, "parent\s+(\d+)"),0)
187+ | alter // Derive target process from the cmdline (CRTX-257648: basename of first token; path = first token if it contains "/")
188+ target_first_token = arrayindex(regextract(command_line, "^(\S+)"),0)
189+ | alter
190+ target_process_name = arrayindex(regextract(target_first_token, "([^\/]+)$"),0),
191+ target_process_path = if(target_first_token ~= "\/", target_first_token, null)
173192
174193| alter // Map to XDM
175194 xdm.source.host.hostname = parsed_fields -> hostname,
176- xdm.source.process.name = process_name,
177- xdm.source.process.pid = to_integer(pid),
178- xdm.source.process.command_line = command_line,
179- xdm.source.process.parent_id = ppid,
195+ xdm.source.process.name = source_process_name,
196+ xdm.source.process.pid = to_integer(source_pid),
197+ xdm.target.process.pid = to_integer(target_pid),
198+ xdm.target.process.name = target_process_name,
199+ xdm.target.process.executable.path = target_process_path,
200+ xdm.target.process.command_line = command_line,
180201 xdm.event.operation = XDM_CONST.OPERATION_TYPE_PROCESS_START,
181202 xdm.event.operation_sub_type = "System process start";
182203
0 commit comments