Hi I am having two indexes
with following fields : name,packets,sourceip
has following fields : category,classification,ipaddress
In the above two indexes fields sourceip and ipaddress both contains the ipadresses(ex. 22.214.171.124 , 126.96.36.199 etc..) . So you can see here sourceip and ipaddress are the common fields .Now i want to perform join over these two indexes with the help of STATS not with JOIN because JOIN has performance issues.
I'll be very thankful if someone can provide the solution on same.
Here's how I would tackle this with stats. (This assumes each ip address can only appear in each data set once)
index=A OR index=B | rename sourceip as ipaddress | stats count first(name) as name first(packets) as packets first(category) as category first(classification) as classification by ipaddress | where count>1
where filter will omit anything which only shows up in both datasets. (You could also filter on a specific field being null, such as
|where isnull(category) for example.
What is the timeframe of your search? The section without an explicit earliest/latest will be bound by the timeframe you select in the UI.
Providing earliest and latest with index ex. (index=A earliest=-1d@d latest=@d) OR (index=B) is not working for me.
can you elaborate more on same.
Somehow this didn't work for me earlier forcing me to use |multisearch. It works fine now. stumped...
Multisearch isn't necessary. Just use simple boolean operators.
(index=A earliest=-1d@d latest=@d) OR (index=B) | ...
modify earliest/latest requirements as needed.
|multisearch [search index=A earliest=-25h@h][search index=B] | ....rest of the search
Query :: How can i handle two different time range in this search??
I want to perform search on where index A result for last 24 hrs and index B for All time. How do i write earliest/latest two time here in this single search?
You can do by renaming the fields.
index=A OR index=B|rename ipaddress as sourceip|stats avg(packets) by sourceip
|multisearch [search index=A|table name,packets,sourceip][search index=B | table category,classification,ipaddress|rename ipaddress as sourceip]|stats avg(packets) by sourceip
Basically do you want to know common IP Address among two sources or looking of other information as well?
Thanks for your quick response linu.... but it does not solve my problem ... let me elaborate this more ..
The sourceIP has following values ex.
AND ipaddress field has following value ex.
You can see above there is only one value "188.8.131.52" WHICH is common for both fields sourceip and ipaddress.
I want result which gives me only this value not all(like natural join).
How can i achieve this??
Waiting for your reply !!