In follow up to my latest post timelining sysmon logs, heres the search I wrote to include all events between a 4624 (logon) and the 4625 (logoff). This one doesn't work perfectly in all scenarios. However, I've triaged plenty of malicious activity very quickly using this.
==============================
index=eventlogs LogName IN ($sources$) EventCode IN ($eventid$) ComputerName=$host$
$search$
| eval includeEventId=if("$eventid$"=="*", "yes", if(isnull(mvfind(split("$eventid$", ","), tostring(EventCode))), "no", "yes"))
| eval excludeEventId=if("$removeeventid$"=="*", "no", if(isnull(mvfind(split("$removeeventid$", ","), tostring(EventCode))), "no", "yes"))
| eval includeSource=if($sources$=="*", "yes", if(isnull(mvfind(split($sources$, ","), LogName)), "no", "yes"))
| eval excludeSource=if("$removesources$"=="*", "no", if(isnull(mvfind(split("$removesources$", ","), LogName)), "no", "yes"))
| where includeEventId="yes" AND excludeEventId="no" AND includeSource="yes" AND excludeSource="no"
| eval timex=_time
| where timex >=$start$ AND timex <=$end$
| eval TimeX=if(timex == 0 OR timex== 0, "Original",null())| fillnull EventCode value=""
| eval LogName="Log: ". LogName. "(" . EventCode. ")"
| fillnull LogName value=""
| sort _time
| table LogName, Message, RecordNumber, _time
==============================