SlideShare a Scribd company logo
Bengaluru User
Group
WELCOME
1st Aug 2020
स्वागत
স্বাগত
ಸ್ವಾಗತ
स्वागत आहे
స్వాగతவரவவற்பு
സ്വാഗതം
ਸਵਾਗਤ ਹੈ
સ્વાગત છે
‫آمدید‬ ‫خوش‬
ସ୍ୱାଗତ
‫آیا‬ ‫ڪري‬ ‫ڀلي‬
https://conf.splunk.com/
https://www.youtube.com/watch?v=C8UzEaF2OwQ
Housekeeping
Join #splunk_bengaluru_usergroup on Slack http://splk.it/slack
Use #splunk_bengaluru_usergroup for Q&A during the session
Please keep your lines muted when not speaking
Slides, recording & feedback form will be posted to the Events page
Splunk Bengaluru User Group
https://usergroups.splunk.com/bengaluru-splunk-user-group/
Search Tips Optimization & Best Practices
Software Engineer (Cisco)
Splunk Trust MVP (2019,2020)
Kamlesh Vaghela
Search Tips
Optimization & Best
Practices
Kamlesh Vaghela
Software Engineer (Cisco)
© 2020 SPLUNK INC.
Components of SPL:
1. Search Terms
2. Commands
3. Functions
4. Clauses
Search Processing Language
ANY question of ANY machine data
SPL
© 2020 SPLUNK INC.
Search Processing Language
ANY question of ANY machine data
SPL
© 2020 SPLUNK INC.
Search Processing Language
ANY question of ANY machine data
SPL
© 2020 SPLUNK INC.
What’s in a Bucket?
SPL
• Journal.gz
• Events go here
• Made up of from many smaller compressed slices
• Raw data collected and saved into slices
– 1 slice = ~128KB of uncompressed data
• TSIDX files
• associates each unique keyword in your data with
location references to events
• Bloom Filters
• bloom filters narrow the set of tsidx files
Search
Optimization
Tips
© 2020 SPLUNK INC.
• Retrieve only the required data
• Move as little data as possible
• Parallelize as much work as possible
• Set appropriate time windows
• Map Reduce
Basic Principles
Search
Optimization
© 2020 SPLUNK INC.
• Filter as much as possible in the initial search
• Perform joins and lookups on only the required
data
• Perform evaluations on the minimum number of
events possible
• Move commands that bring data to the search
head as late as possible in your search criteria
• Summary Indexing
• Data Model Acceleration
Techniques
Search
Optimization
What I should Avoid?
Avoid Why? Should do
All time • Events are stored in time-series order
• Reduce searched bucket by being specific
• Use Specific time range
• Narrow the time range as much as
possible
index=* • Events are grouped into indexes
• Reduce searches buckets by specifying an index.
• Specify an index in the search
wildcards • Wildcards are not compatible with Bloom Filters
• Wildcard matching to term in the index takes time
• Varying levels of pain
1. myterm*: Not great
2. *myterm: Bad
3. *myterm*: Death
• Use the OR Operator
1. myterm1 OR myterm2…
What I should Avoid?
Avoid Why? Should do
NOT
!=
• Bloom Filters & indexes are designed to quickly locate
terms that exist
• Searching for that term which not exists takes longer
• Use AND/OR operators
Verbose Search Mode • Verbose search mode causes full event data to be sent
to the search head, even if isn’t needed.
• Use Smart Mode or Fast Mode
Real-time Searches • RT searches put an increased load on search head and
indexer
• Use a scheduled search that occurs
more frequently
Joins / Sub-searches • This is intensive search command • Use the stats (preferred)
Search after first pipe • Filtering search results using a second | search
command in your query is inefficient
• As much as possible, add all filtering
criteria before the first |
Search Tips
& Best
Practices
table vs fields
index=main | head 1000
| table A B C D E
index=main
|fields A B C D E | head 1000
|table A B C D E
Weak Strong
Faster Searches
Keep it kosher - Cosmetics at end
index=_internal
| rename host as "Client Machine"
| stats count by "Client Machine"
index=_internal
| stats count by host
| rename host as "Client Machine"
Weak Strong
Pretty Searches
Require Fields
index=_internal WARN
| stats count
index=_internal log_level="WARN"
| stats count
Weak Strong
Faster Searching
Be specific
index=_internal
"_ACCELERATE_DM_test_Test.executed_
background_job_ACCELERATE_"
| timechart count
index=_internal sourcetype=scheduler
savedsearch_name="_ACCELERATE_DM
_test_Test.executed_background_job_ACC
ELERATE_"
| timechart count
Weak Strong
Faster Searching
stats vs dedup/transaction
phone=* | dedup phone| table phone| sort phone
phone=*| transaction host | table host, phone
phone=*
| stats count by phone, host
| fields - count
Weak Strong
Faster Searching
multi-eval
| eval this=”is”
| eval a=“verbose”
| eval example=“of eval”
| eval this=”is”, a=“verbose”, example=“of
eval”
Weak Strong
Pretty Searching
foreach is clean
| timechart span=1h limit=0
sum(eval(b/pow(1024,3))) as size by st
| timechart span=1h limit=0 sum(b) by st
| foreach * [eval
"<<FIELD>>"=if("<<FIELD>>" == "_time",
_time, '<<FIELD>>' / pow( 1024 , 3 ))]
Weak Strong
Pretty & Faster Searching
coalesce’s cooler than if
| eval size = if(isnull(bytes) , if( isnull(b) ,
"N/A" , b ) ,bytes )
|eval size = coalesce( bytes , b , "N/A" )
Weak Strong
Pretty Searches
Avoid Subsearches
index=burch | eval blah=yay
| append
[ search index=simon | eval blah=duh ]
( index=burch … ) OR ( index=simon …)
| eval blah=case( index==”burch" , "yay" ,
index==”simon" ,"duh" )
Weak Strong
Faster Searching
NOT NOTs OR !=
index=_internal NOT log_level=INFO | stats
count by log_level
index=_internal log_level!=INFO | stats
count by log_level
index=_internal log_level IN
("ERROR","WARN","WARNING") | stats
count by log_level
Weak Strong
Faster Searching
transaction
...| transaction host …| transaction maxspan=10m
maxevents=100 …
Weak Strong
Search Commands
metadata
index=* | stats count by host | metadata index=* type=hosts
Weak Strong
Search Commands
eventcount
index=* | stats count by host | eventcount summarize=false index=*
Weak Strong
Search Commands
Event Types & Tags
index=oidemo
host=dmzlog.splunktel.com
sourcetype=access_combined
source=/opt/apache/log/access_com
bined.log iphone
user_agent="*iphone*”
| stats count by action
tag=iphone_event
or
eventtype=web_logs
Weak Strong
Search Tangent
Search
Tricks
Top 5 Trending Values
Bottom 5 Trending Values
makeresults & multikv
extract
mvzip, split & mvindex
addcoltotals in table header
CASE & TERM
Job Inspector & Search Logs
References
https://docs.splunk.com/Documentation/Splunk/latest/Search/Aboutoptimization
https://docs.splunk.com/Documentation/Splunk/latest/Search/Quicktipsforoptimization
https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Regex
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Timechart#Where_clause_exa
mples
https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Acceleratedatamodels#Enable_mul
ti-eval_to_improve_data_model_acceleration
References
https://conf.splunk.com/files/2017/slides/searching-fast-how-to-start-using-tstats-and-other-
acceleration-techniques.pdf
https://conf.splunk.com/files/2019/slides/FNC2751.pdf
https://www.slideshare.net/Splunk/splunk-search-optimization
https://conf.splunk.com/files/2016/slides/best-practices-and-better-practices-for-users.pdf
https://docs.splunk.com/Documentation/Splunk/latest/Search/UseCASEandTERMtomatchphrases
https://docs.splunk.com/Documentation/Splunk/latest/Search/NOTexpressions
References
https://docs.splunk.com/Documentation/Splunk/latest/Search/Writebettersearches
https://docs.splunk.com/Documentation/Splunk/latest/Search/Built-inoptimization
https://www.splunk.com/en_us/blog/tips-and-tricks/splunk-clara-fication-search-best-practices.html
https://static.rainfocus.com/splunk/splunkconf18/sess/1523558790516001KFjM/finalPDF/Behind-The-
Magnifying-Glass-1734_1538786592130001CBKR.pdf
https://docs.splunk.com/Documentation/Splunk/8.0.5/Search/Typesofcommands
Thank You
© 2020 SPLUNK INC.
Q&A
Raise hand to be unmuted Post questions in WebEx
Chat
Join Slack for Q&A
http://splk.it/slack
© 2020 SPLUNK INC.
Challenges on Slack
#splunk_bengaluru_usergroup
• Challenges from July Bengaluru User Group sessions.
• Challenges from current session (to be posted over the
weekend).
© 2020 SPLUNK INC.
Community Resources
Splunk Community Resources (Both Official and Unofficial)
Splunk > Clara-fication: Splunk Community: https://www.splunk.com/en_us/blog/tips-
and-tricks/splunk-clara-fication-splunk-community.html
We plan to meet 1st Saturday of every month at 11:00 AM IST.
Please provide feedback for :
• Sessions and improvements.
• Topics to be covered in future sessions.
• Let us know if you are interested in presenting in User Group.
Keep the comradery through Slack and Splunk Answers>
What’s Next
http://splk.it/slack http://community.splunk.com
https://conf.splunk.com
Splunk .Conf 2020 registrations are open: Oct 20th and 21st (Virtual)

More Related Content

Similar to Splunk bangalore user group 2020 08 01 (20)

PPTX
SplunkLive! London: Splunk ninjas- new features and search dojo
Splunk
 
PPTX
Power of SPL
Tian Chen
 
PDF
FNC2751.pdf
CristhianEspinosa6
 
PDF
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld
 
PPTX
Splunk bsides
Macy Cronkrite
 
PPTX
Splunk Ninjas: New Features and Search Dojo
Splunk
 
PPTX
TSTAS, the Life of a Splunk Trainer and using DevOps in Splunk Development
Harry McLaren
 
PPTX
Splunk live! ninjas_break-out
Splunk
 
PPTX
Power of SPL Breakout Session
Splunk
 
PPTX
Power of SPL Breakout Session
Splunk
 
PPTX
Splunk Ninjas: New features, pivot, and search dojo
Splunk
 
PPTX
Splunk Ninjas: New Features and Search Dojo
Splunk
 
PPTX
Splunk Ninjas: New Features, Pivot, and Search Dojo
Splunk
 
PPT
Splunk .conf2011: Search Language: Intermediate
Erin Sweeney
 
PDF
Splunk conf2014 - Lesser Known Commands in Splunk Search Processing Language ...
Splunk
 
PDF
Nationwide Splunk Ninjas!
Splunk
 
PPTX
Power of SPL Breakout Session
Splunk
 
PDF
Postgres performance for humans
Craig Kerstiens
 
PDF
MySQL Query Optimization (Basics)
Karthik .P.R
 
PDF
Using splunk6.2 labs
Jagadish a
 
SplunkLive! London: Splunk ninjas- new features and search dojo
Splunk
 
Power of SPL
Tian Chen
 
FNC2751.pdf
CristhianEspinosa6
 
VMworld 2013: Deep Dive into vSphere Log Management with vCenter Log Insight
VMworld
 
Splunk bsides
Macy Cronkrite
 
Splunk Ninjas: New Features and Search Dojo
Splunk
 
TSTAS, the Life of a Splunk Trainer and using DevOps in Splunk Development
Harry McLaren
 
Splunk live! ninjas_break-out
Splunk
 
Power of SPL Breakout Session
Splunk
 
Power of SPL Breakout Session
Splunk
 
Splunk Ninjas: New features, pivot, and search dojo
Splunk
 
Splunk Ninjas: New Features and Search Dojo
Splunk
 
Splunk Ninjas: New Features, Pivot, and Search Dojo
Splunk
 
Splunk .conf2011: Search Language: Intermediate
Erin Sweeney
 
Splunk conf2014 - Lesser Known Commands in Splunk Search Processing Language ...
Splunk
 
Nationwide Splunk Ninjas!
Splunk
 
Power of SPL Breakout Session
Splunk
 
Postgres performance for humans
Craig Kerstiens
 
MySQL Query Optimization (Basics)
Karthik .P.R
 
Using splunk6.2 labs
Jagadish a
 

Recently uploaded (20)

PDF
Classifcation using Machine Learning and deep learning
bhaveshagrawal35
 
PPTX
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
PPTX
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
PPTX
short term internship project on Data visualization
JMJCollegeComputerde
 
PDF
SUMMER INTERNSHIP REPORT[1] (AutoRecovered) (6) (1).pdf
pandeydiksha814
 
PPTX
Data-Users-in-Database-Management-Systems (1).pptx
dharmik832021
 
PDF
Basotho Satisfaction with Electricity(Statspack)
KatlehoMefane
 
PPT
introdution to python with a very little difficulty
HUZAIFABINABDULLAH
 
PPTX
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
PDF
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
apidays
 
PPTX
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
DOCX
Q1_LE_Mathematics 8_Lesson 4_Week 4.docx
ROWELLJAYMALAPIT
 
PPTX
Introduction to Data Analytics and Data Science
KavithaCIT
 
PDF
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays
 
PPT
From Vision to Reality: The Digital India Revolution
Harsh Bharvadiya
 
PPT
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
PDF
Blue Futuristic Cyber Security Presentation.pdf
tanvikhunt1003
 
PPTX
White Blue Simple Modern Enhancing Sales Strategy Presentation_20250724_21093...
RamNeymarjr
 
PPTX
lecture 13 mind test academy it skills.pptx
ggesjmrasoolpark
 
PDF
Top Civil Engineer Canada Services111111
nengineeringfirms
 
Classifcation using Machine Learning and deep learning
bhaveshagrawal35
 
7 Easy Ways to Improve Clarity in Your BI Reports
sophiegracewriter
 
M1-T1.pptxM1-T1.pptxM1-T1.pptxM1-T1.pptx
teodoroferiarevanojr
 
short term internship project on Data visualization
JMJCollegeComputerde
 
SUMMER INTERNSHIP REPORT[1] (AutoRecovered) (6) (1).pdf
pandeydiksha814
 
Data-Users-in-Database-Management-Systems (1).pptx
dharmik832021
 
Basotho Satisfaction with Electricity(Statspack)
KatlehoMefane
 
introdution to python with a very little difficulty
HUZAIFABINABDULLAH
 
Presentation (1) (1).pptx k8hhfftuiiigff
karthikjagath2005
 
apidays Munich 2025 - The Physics of Requirement Sciences Through Application...
apidays
 
Future_of_AI_Presentation for everyone.pptx
boranamanju07
 
Q1_LE_Mathematics 8_Lesson 4_Week 4.docx
ROWELLJAYMALAPIT
 
Introduction to Data Analytics and Data Science
KavithaCIT
 
apidays Munich 2025 - Developer Portals, API Catalogs, and Marketplaces, Miri...
apidays
 
From Vision to Reality: The Digital India Revolution
Harsh Bharvadiya
 
Real Life Application of Set theory, Relations and Functions
manavparmar205
 
Blue Futuristic Cyber Security Presentation.pdf
tanvikhunt1003
 
White Blue Simple Modern Enhancing Sales Strategy Presentation_20250724_21093...
RamNeymarjr
 
lecture 13 mind test academy it skills.pptx
ggesjmrasoolpark
 
Top Civil Engineer Canada Services111111
nengineeringfirms
 
Ad

Splunk bangalore user group 2020 08 01