Knowledge Management

Appending tables in searches

SplnkUse
Path Finder

Hello

Is it possible to append two searches?

I have a search that ends in:

| table A B C

And I want to append to the above some values under A, B, C that I calculate.

Can you tell me please the syntax for that?

Thanks!

Tags (1)
0 Karma

ldongradi_SPL
Splunk Employee
Splunk Employee

| append [...] will append the inner search results to the outer search. For example: index=foo | stats count | append [index=bar | stats count]

| appendpipe [...] will prolongate the outer search with the inner search modifications, and append the results instead of replacing them. For example: ... | appendpipe [ | stats count as extracount]

| eventstats ... will add extra columns to an existing table with a treatment like a stats, without any further transformation. For example | eventstats avg(bytes) by server 

| streamstats ... will add extra columns to an existing table, but each calculated result depend on the previous results. For example:  | streamstats count as rank

For your needs, append may not be what you're looking for. The 2 searches are independant.

0 Karma

SplnkUse
Path Finder

@ITWhisperer  thanks but I cannot make it work, it seems it does not keep aliases within the brackets and run the whole thing as one, instead of each separately and then join, is there any solution?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What is the actual search that you are using?

0 Karma

SplnkUse
Path Finder

@ITWhisperer  thanks, I am trying to combine searches in the following format. I know it may be difficult to picture the below but I cannot post more exact data.

 

I think the problem is that  the:

 eval a="aaa"

is contained in two different searches and is set to different values.

Any idea?

index=a aa!="" | fields aa
| stats count by aa
| eval a="aa"
| eval Timestamp=strftime(now(),"%d/%m/%Y %H:%M:00")
| table a b c

| append [
search
index=aa or index=bbb
| eval
| stats
| eval a="aaa"
| eval Timestamp=strftime(now(),"%d/%m/%Y %H:%M:00")
| table a bb cc
]
| append [
search
index=aa or index=bbb
| eval
| stats
| eval a="aaaa"
| eval Timestamp=strftime(now(),"%d/%m/%Y %H:%M:00")
| table a bbb ccc

0 Karma

PickleRick
SplunkTrust
SplunkTrust

The syntax looks ok, but each of your subsearches returns different set of fields. If you want to have three columns as output, you have to return the same set of fields from each of subsearches. Do a rename at the end of your subsearches so that the returned fields are named consistently.

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

This is the right sort of syntax - what is the issue you are facing with doing it this way?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
search
| table A B C
| append
  [search
   | table A B C]
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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...