- Implementing Splunk(Second Edition)
- Vincent Bumgarner James D. Miller
- 410字
- 2021-07-16 13:34:55
Making searches faster
We have talked about using the index to make searches faster. When starting a new investigation, the following few steps will help you get results faster:
- Set the time to the minimum time that you believe will be required to locate relevant events. For a chatty log, this may be as little as a minute. If you don't know when the events occurred, you might search a larger time frame and then zoom in by clicking on the timeline while the search is running.
- Specify the index if you have multiple indexes. It's good to get into the habit of starting your queries with the index name. For example,
index=myapplicationindex error bob
. - Specify other fields that are relevant. The most common fields to specify are sourcetype and host. For example,
index=myapplicationindex sourcetype="impl_splunk_gen" error bob
. If you find yourself specifying the field source on a regular basis, you could probably benefit from defining more source types. Avoid using thesourcetype
field to capture other information, for instance datacenter or environment. You would be better off using a lookup against host or creating another indexed field for those cases. - Add more words from the relevant messages as and when you find them. This can be done simply by clicking on words or field values in events, or field values in the field picker. For example,
index=myapplicationindex sourcetype="impl_splunk_gen" error bob authclass OR fooclass
. - Expand your time range once you have found the events that you need, and then refine the search further.
- Disable Field discovery in earlier versions of Splunk - there was a toggle at the top of the field picker. In version 6.2, the feature is a bit different. You can simply open the field picker and use the Select All Within Filter or Deselect All checkbox to remove any unneeded fields from the list that Splunk will extract. This can greatly improve speed, particularly if your query retrieves a lot of events. Extracting all the fields from events simply takes a lot of computing time, and disabling this option prevents Splunk from doing all that work when not needed. Take a look at the following screenshot:
If the query you are running is taking a long time to run, and you will be running this query on a regular basis—perhaps for an alert or a dashboard—using a summary index may be appropriate. We will discuss this in Chapter 10, Summary Indexes and CSV Files.
推薦閱讀
- Mastering OpenLayers 3
- SQL Server 從入門到項目實踐(超值版)
- Spring 5.0 By Example
- C# Programming Cookbook
- Mastering Spring MVC 4
- VSTO開發入門教程
- Scratch真好玩:教小孩學編程
- Quarkus實踐指南:構建新一代的Kubernetes原生Java微服務
- 精通MySQL 8(視頻教學版)
- C++從入門到精通(第6版)
- Clojure High Performance Programming(Second Edition)
- Java EE 8 and Angular
- 從零開始學UI:概念解析、實戰提高、突破規則
- 3D Printing Designs:Design an SD Card Holder
- Spring Boot 2+Thymeleaf企業應用實戰