Author: Robert Labrie, The Network Inc
This technology add-on provides a dynamic lookup to add fields to user
agent (browser) data. It is a re-write of the TA-browscap add-on by
David Shpritz. The data is provcided by the Broser Capabilities Project. The parser is a re-write of the parser in the pybrowscap library. This add-on is faster than other browscap based projects, because it maintains a cache of previously matched user agent strings. This significantly improves the time for subsequent lookups, without sacrificing accuracy.
All fields in the browscap file are included
ua_agentid=The unique ID of the user agent in the BrowsCapCSV
ua_aolversion=AOL version, or 0 if not applicable
ua_browser=The browser family: FireFox, Chrome, IE, etc
ua_comment=Browser + version
ua_crawler=true/false - true if the UA is some Web Crawler
ua_cssversion=CSS version support
ua_litemode <-- I don't know what this means
ua_masterparent <-- I don't know what this means
ua_parent <-- I don't know what this means
ua_platform=Operating system and version. Win7, etc
ua_platform_version=The OS version, not the friendly name. Win7 is 6.1
ua_propertyname=The original browscap string which matched the UA
ua_fromcache=True if this record was read from cache, false if from the browscap file
1. Untar the TA-browscap.tar.gz file in your $SPLUNK_HOME/etc/apps
2. Change to the $SPLUNK_HOME/etc/apps/TA-browscap/bin directory
3. Download the browscap.csv file from the project:
wget -O browscap.csv http://browscap.org/stream?q=BrowsCapCSV
4. Restart Splunk.
The optional configuration file, browscap_lookup.ini, allows changing the default location of the browscap_lite.csv (cache) file.
The lookup expects a field named "http_user_agent". In the search bar,
you can run something like:
index=iis | eval http_user_agent=urldecode(cs_User_Agent) | lookup browscap_lookup_express http_user_agent
The UserAgent string must be urldecoded.
This should produce the additional fields.
THE FIRST FEW SEARCHES WILL BE VERY SLOW
TA-browscap_express builds a cache of user agents which exist in your data. The first time a string is encountered, the entire browscap file must be searched. Subsequent searches will be faster. Be patient while the cache is built. I suggest using a search limiter like "| head 10", then increasing that number. In a few minutes, your cache will be populated and the searches will be very fast.
Not all browsers are cached. Generic and default browsers are deliberately not cached. To search for browsers which are always looking up in the browscap file try adding "| search ua_fromcache=false". You can either exlcude these UA strings at the start, or better, file a bug with the browscap project on github to get the UA string added to the library.
The cache file, browscap_lite.csv, is checked first, speeding up subsequent searches. The location of the file is as follows:
1. The script directory. This is the default location, unless:
2. SPLUNK_HOME/var/run/splunk if the SPLUNK_HOME environment variable is defined, this location will be used, unless:
3. It's overridden in browscap_lite.ini
The optional file, blacklist.txt, contains a list of UA strings, one per line, which should not be checked. This is good for managing custom or blatantly forged UA strings that you don't want to waste time going to the main browscap file for, since they'll always return default/generic.
20130607 v1: Initial
20140820 v2: Better
Splunk AppInspect evaluates Splunk apps against a set of Splunk-defined criteria to assess the validity and security of an app package and components.
As a Splunkbase app developer, you will have access to all Splunk development resources and receive a 50GB license to build an app that will help solve use cases for customers all over the world. Splunkbase has 1000+ apps and add-ons from Splunk, our partners and our community. Find an app or add-on for most any data source and user need, or simply create your own with help from our developer portal.