Skip to content

Instantly share code, notes, and snippets.

@metasyn
Created July 14, 2015 20:09
Show Gist options
  • Save metasyn/a9e4552da84f25659d12 to your computer and use it in GitHub Desktop.
Save metasyn/a9e4552da84f25659d12 to your computer and use it in GitHub Desktop.
// prism languages for splunk searches.
Prism.languages.mcurve = {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'saf' : /\|?\s*(search|where)[^\|]*/,
'munge' : /\|\s*(eval|eventstats|streamstats)[^\|]*/,
'report' : /\|\s*(stats|timechart|chart)[^\|]*/,
'cleanup' : /\|\s*(rename)[^\|]*/,
//{everything leading up to first |}/
'dsaf' : /[\s\w\|]+.+/,
}
Prism.languages.spl = {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'regex': {
pattern: /(rex) field\s*=\s*\S*\s*"[^"]*"/,
lookbehind: true,
inside: {
'function': /"[^"]*/
}
},
'string': /("|')(\\?.)*?\1/g,
'punctuation' : /\(|\)|\[|\]|\|/g,
'operator' : /=|\+/g,
'keyword': /\b(abstract|accum|addcoltotals|addinfo|addtotals|analyzefields|anomalies|anomalousvalue|append|appendcols|appendpipe|arules|associate|audit|autoregress|bin|bucket|bucketdir|chart|cluster|cofilter|collect|concurrency|contingency|convert|correlate|crawl|datamodel|dbinspect|dedup|delete|delta|diff|erex|eval|eventcount|eventstats|extract|fieldformat|fields|fieldsummary|filldown|fillnull|findtypes|folderize|foreach|format|gauge|gentimes|geoip|geostats|head|highlight|history|input|index|inputcsv|inputlookup|iplocation|join|kmeans|kvform|loadjob|localize|localop|lookup|makecontinuous|makemv|map|metadata|metasearch|multikv|multisearch|mvcombine|mvexpand|nomv|outlier|outputcsv|outputlookup|outputtext|overlap|pivot|predict|rangemap|rare|regex|relevancy|reltime|rename|replace|rest|return|reverse|rex|rtorder|run|savedsearch|script|scrub|search|searchtxn|selfjoin|set|setfields|sendemail|sichart|sirare|sistats|sitimechart|sitop|sort|spath|stats|strcat|streamstats|table|tags|tail|timechart|top|transaction|transpose|trendline|tscollect|tstats|typeahead|typelearner|typer|uniq|untable|where|x11|xmlkv|xmlunescape|xpath|xyseries)\b/,
'function':/\b(abs|case|ceil|ceiling|cidrmatch|coalesce|commands|exact|exp|floor|if|ifnull|isbool|isint|isnotnull|isnull|isnum|isstr|len|like|ln|log|lower|ltrim|match|max|md5|min|mvappend|mvcount|mvindex|mvfilter|mvjoin|mvrange|mvzip|now|null|nullif|pi|pow|random|relative_time|replace|round|rtrim|searchmatch|sha1|sha256|sha512|sigfig|spath|split|sqrt|strftime|strptime|substr|time|tonumber|tostring|trim|typeof|upper|urldecode|validate|avg|c|count|dc|distinct_count|earliest|estdc|estdc_error|exactperc|first|last|latest|list|max|median|min|mode|p|perc|range|stdev|stdevp|sum|sumsq|upperperc|values|var|varp)\b/,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment