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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...