Splunk Search

Combine two searches

qysplunk
Loves-to-Learn Lots

Hi, I have 2 sample logs and I need to combine them into 1 query to grab the "Accesses" values,

qysplunk_0-1624983483540.png

Due to the log format differences, I have combined 2 different queries using append/sub-search. However I noticed, the subquery results will shows up in the "CE" field, but does not show up in "TC" field .

Or is there another way I can do to capture the Accesses value of these 2 log?

index=nginx (("SourceName=Microsoft Windows security auditing" AND EventCode=4663 AND "Message=An attempt was made to access an object" AND Object_Name="C:\\Program Files\\nginx-1.18.0\\conf\\*.conf" AND ("Accesses:*")) OR (SourceName=Microsoft-Windows-TerminalServices-LocalSessionManager AND EventCode=21))
| eval Date = strftime(_time, "%Y-%d-%m")
| eval Hostname = upper(host)
| eval Date = strftime(_time, "%Y-%d-%m")
| eval Time = strftime(_time, "%Y-%d-%m %H:%M:%S")
| rex field=Message "Accesses:\s+(?P<Action>[^<]+)"\s+Access
| append
[ search index=nginx ((EventCode=4656 Object_Name="C:\\Program Files\\nginx-1.18.0\\conf\\*.conf" Process_Name=C:\\Windows\\explorer.exe) OR (SourceName=Microsoft-Windows-TerminalServices-LocalSessionManager AND EventCode=21))
| rex field=Message max_match=0 "Accesses:\s+(?P<Action>[^>]+)"\s+Access\sReasons]
| rex field=Action mode=sed "s/\s{2,}/\n/g"
| strcat Action "-> " Object_Name CE
| eval TC = mvzip(Time,'CE')
| stats values(TC) as TC latest(Source_Network_Address) as "IP Address" by Date index Hostname
| where isnotnull(TC)
| mvexpand TC
| makemv TC delim=","
| eval Time=mvindex(TC, 0)
| eval "Events"=mvindex(TC, 1)
| fields Time Events Hostname "IP Address"
| where Events' != "-> "

Thank you

Labels (3)
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...