

You can also know about : USAGE OF SPLUNK COMMANDS : TRANSPOSE Then by the “table” command, we have taken “DATE” and by the “dedup” command we have removed the duplicate values. We have extracted the date from the raw log so we have put “field=_raw” with the “rex” command and the new field name is “DATE”. In the above query, we are getting data from the “_internal” index and the sourcetype name is “splunkd_ui_access”. Query: index=_internal sourcetype=splunkd_ui_access | rex field=_raw ".*\s+\[(?\d+\/\w+\/\d+)\:\d+.*" | table DATE | dedup DATE Suppose we want to extract 08/Sep/2018 as DATE. Suppose we have a data which is coming from any of the indexes.

See Extract fields using regular expressions.For a longer filepath, such as c:\\temp\example, you would specify c:\\\\temp\\example in your regular expression in the search string. You must escape both backslash characters in a filepath by specifying 4 consecutive backslashes for the root portion of the filepath. The filepath is interpreted as c:\temp, one of the backslashes is removed. Searches that include a regular expression that contains a double backslash, such as in a filepath like c:\\temp, the search interprets the first backslash as a regular expression escape character. The backslash cannot be used to escape the asterisk in search strings. Splunk SPL uses the asterisk ( * ) as a wildcard character. If you want to match a period character, you must escape the period character by specifying \. The period character is used in a regular expression to match any character, except a line break character. The backslash character ( \ ) is used in regular expressions to "escape" special characters.

This is interpreted by SPL as a search for the text "expression" OR "with pipe". For example, A or B is expressed as A | B.īecause pipe characters are used to separate commands in SPL, you must enclose a regular expression that uses the pipe character in quotation marks. Here are a few things that you should know about using regular expressions in Splunk searches.Ī pipe character ( | ) is used in regular expressions to specify an OR condition.

You can also use regular expressions with evaluation functions such as match and replace. You can use regular expressions with the rex and regex commands. Splunk Search Processing Language (SPL) regular expressions are PCRE (Perl Compatible Regular Expressions).
