We all know splunk can make time chart. For example, we want to know how many http requests are received on a particular type of servers. A typical splunk query could be:
index=http_stats_10d sourcetype=FRONT_END_LB host=*-mobileweb-* | timechart count by host
The timechart will be grouped by host such as pvd-mobileweb-001, pvd-mobileweb-002, pvd-mobileweb-003, chi-mobileweb-001, chi-mobileweb-002, tor-mobileweb-001, tor-mobileweb-002, tor-mobileweb-003.
Now let's assume we want to group the timechart by data site prefix string pvd, chi and tor instead of the whole hostname string. The following technique will do the trick.
eval site=mvindex(split(host, "-"), 0)
the above command reads, split host string by "-" and take the the index 0 element from the result array, and assign it to variable site. This way we extracts the prefix from the host string.
Now we can revise our splunk query to group by site instead of by host.
index=http_stats_10d sourcetype=FRONT_END_LB host=*-mobileweb-*
| eval site=mvindex(split(host, "-"),0)
| timechart count by site
This blog is about Ad-Hoc knowledge spreading to broad range of spectrum: software, electronics, computer hardware, wireless, system engineer, IoT, information security, NLP, Cloud, AI, ML, E-commerce, blog, search engine...Internet is ran by do good individuals, wish the knowledge be with you.
Subscribe to:
Post Comments (Atom)
meta.ai impression
Meta.ai is released by meta yesterday, it is super fast you can generate image while typing! You can ask meta.ai to draw a cat with curvy fu...
-
1. Digg 2. Twitter 3. FriendFeed 4. Reddit 5. Hacker News 6. Facebook 7. MySpace 8. LinkedIn 9. Flixster 10. Flickr
-
It is super easy. On the top-right hand of youtube page, there is a textbox labeled "embed". Just copy the content in the textbox,...
-
Show   Hide Here is the text you would like to show --------------------------------------------------------------------------- I f...
No comments:
Post a Comment