Splunk Search

Why is the append query not working?

Mohsin123
Path Finder

hi,

index="idx_a" sourcetype IN ("logs") component=* logpoint=request-in 
| table transaction-id,timestamp-in| append 
    [ search index="idx_a" sourcetype IN ("logs") component=* logpoint=response-out 
    | table timestamp-out] 
| table transaction-id,timestamp-in,timestamp-out

In my last query, timestamp-out is blank.
Can anyone please help?

Tags (2)
0 Karma
1 Solution

PowerPacked
Builder

Hi @Anonymous

Are you trying to do a table of transaction-id,timestamp-in,timestamp-out with proper results,

Use the join command like this

index="idx_a" sourcetype IN ("logs") component= logpoint=request-in
| table transaction-id,timestamp-in| join transaction-id
[ search index="idx_a" sourcetype IN ("logs") component= logpoint=response-out
| table timestamp-out, transaction-id]
| table transaction-id,timestamp-in,timestamp-out

Only Join will map the transaction id with respective timestamp-in & timestamp-out.
Appendcols & append commands are used to append the results from main search to sub search, which is not a table of ordered correctly mapped data

Thanks

View solution in original post

0 Karma

PowerPacked
Builder

Hi @Anonymous

Are you trying to do a table of transaction-id,timestamp-in,timestamp-out with proper results,

Use the join command like this

index="idx_a" sourcetype IN ("logs") component= logpoint=request-in
| table transaction-id,timestamp-in| join transaction-id
[ search index="idx_a" sourcetype IN ("logs") component= logpoint=response-out
| table timestamp-out, transaction-id]
| table transaction-id,timestamp-in,timestamp-out

Only Join will map the transaction id with respective timestamp-in & timestamp-out.
Appendcols & append commands are used to append the results from main search to sub search, which is not a table of ordered correctly mapped data

Thanks

0 Karma

CarsonZa
Contributor

try |appendcols instead of |append

0 Karma
Get Updates on the Splunk Community!

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...