8/24/2023 0 Comments Splunk subsearch tutorialsThen in square brackets as a subsearch we have mentioned the query to get values for “ Employee_Name” for “ employee_info_sub” index. Then, we have used the “ search” command with “ NOT” operator because the result from subsearch we want to discard from the result set of primary query. Here, our primary query is, index=employee_info_main | table Employee_Name | dedup Employee_NameĪs, you can see in the query first we have retrieved the unique values for the “ Employee_Name” field in tabular format from index “ employee_info_main” using “ table” and “ dedup” command. Please, see below.ĮXAMPLE: 2 index=employee_info_main | table Employee_Name | dedup Employee_Name | search NOT you want to see all the values for the “ Employee_Name” field, except the values which are present in the “employee_info_sub” index. Now, what if you want to discard the values for “ Employee_Name” for “ employee_info_sub” from the result set i.e. You can also know about : Return Command in Splunk If you will compare the above image with the image: 1 and image: 2, you can easily understand, we successfully searched for the values of “ Employee_Name” field of “ employee_info_sub” index in “ employee_info_main” index. “ employee_info_main”, in square brackets as a subsearch, we have mentioned the query from “ employee_info_sub” index. “ employee_info_sub” inside the 1st index i.e. Then, we have used the “ search” command because the result from sub search we want to search from the result set of the primary query.Īs, we wanted to search for the values of “ Employee Name” of the 2nd index i.e. Here, our primary search is, index=employee_info_main | table Employee_Name | dedup Employee_NameĪnd here, our subsearch is, Īs, you can see in the primary query, first we have retrieved the unique values for “ Employee_Name” field in tabular format from index “ employee_info_main” using “ table” and “ dedup” command. So, let’s see,Įxample: 1 index=employee_info_main | table Employee_Name | dedup Employee_Name | search “ employee_info_main”, you can use subsearch to do that. “employee_info_sub” inside the 1st index i.e. Now, if you want to search for the values of “ Employee Name” field of the 2nd index i.e. Now, as you can see the field “ Employee_Name” contains names of 3 employees. index=employee_info_sub | table Employee_Name | dedup Employee_Name Please, see the below query to see the data for index “ employee_info_sub”, which we will use as the “ subsearch”. Now, as you can see the field “ Employee_Name” contains names of 5 employees. index=employee_info_main | table Employee_Name | dedup Employee_Name Please, see the below query to see the data for index “ employee_info_main” which we will use as “Primary Search”. “ Employee_Name”, which contains the names of some employees. Here, we will use two indexes, 1) employee_info_main 2) employee_info_subĪnd from these two indexes, we are going to take a common field i.e. 1) A subsearch is a search that is used to reduce the set of events from your result set.Ģ) The result of the subsearch is used as an argument to the primary or outer search.ģ) Subsearches must be enclosed in square brackets and must start with a Generating command (eg: search, makeresults etc.).If you want to know more about generating commands, click here.įirst, let me show you the data we are going to use to show you the usage of “ subsearches”.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |