@@ -2213,6 +2213,20 @@ def start(self):
2213
2213
"""
2214
2214
return convert_from_solr (self ._attribute ('start' , - 1 ))
2215
2215
2216
+ @property
2217
+ def end (self ):
2218
+ """
2219
+ Returns the end time of the process (based on the last event received). If the process has not yet exited,
2220
+ "end" will return None.
2221
+
2222
+ :return: datetime object of the last event received for the process, if it has terminated. Otherwise, None.
2223
+ """
2224
+ if self .get ("end" ) is not None :
2225
+ return convert_from_solr (self ._attribute ('end' , - 1 ))
2226
+
2227
+ if self .get ("terminated" , False ) == True and self .get ("last_update" ) is not None :
2228
+ return convert_from_solr (self ._attribute ('last_update' , - 1 ))
2229
+
2216
2230
def require_events (self ):
2217
2231
event_key_list = ['filemod_complete' , 'regmod_complete' , 'modload_complete' , 'netconn_complete' ,
2218
2232
'crossproc_complete' , 'childproc_complete' ]
@@ -2346,7 +2360,8 @@ def children(self):
2346
2360
2347
2361
if self ._children_info is not None :
2348
2362
for i , child in enumerate (self ._children_info ):
2349
- yield CbChildProcEvent (self , convert_event_time (child .get ("start" ) or "1970-01-01T00:00:00Z" ), i ,
2363
+ timestamp = convert_event_time (child .get ("start" ) or "1970-01-01T00:00:00Z" )
2364
+ yield CbChildProcEvent (self , timestamp , i ,
2350
2365
{
2351
2366
"procguid" : child ["unique_id" ],
2352
2367
"md5" : child ["process_md5" ],
@@ -2784,12 +2799,15 @@ def process(self):
2784
2799
if path :
2785
2800
proc_data ["path" ] = path
2786
2801
2802
+ proc_data ["parent_unique_id" ] = self .parent ._model_unique_id
2803
+ proc_data ["parent_id" ] = self .parent .id
2804
+
2787
2805
try :
2788
2806
(sensor_id , proc_pid , proc_createtime ) = parse_process_guid (self .parent .id )
2789
- proc_data [ "parent_unique_id" ] = self . parent . _model_unique_id
2790
- proc_data ["parent_id " ] = self . parent . id
2791
- proc_data [ "sensor_id" ] = sensor_id
2792
- proc_data ["start" ] = proc_createtime
2807
+ if "sensor_id" not in proc_data :
2808
+ proc_data ["sensor_id " ] = sensor_id
2809
+ if "start" not in proc_data :
2810
+ proc_data ["start" ] = convert_to_solr ( proc_createtime )
2793
2811
except Exception :
2794
2812
# silently fail if the GUID is not able to be parsed
2795
2813
pass
0 commit comments