I was able to find the date when the correlation search was last updated, but cant seem to find the original creation date of a correlation search.
... View more
Hello, To pull in specific events in splunk i am trying to write a regex to identify lines that matches both the conditions 1: app_protocol=http or https 2. src_ip = starts with 15. or 16. This is what i have , but doesnt seem to be working , am i doing somting wrong ? .*app_protocol=HTTP|S\s.*(src_ip\=15\.\d+\.\d+\.\d+|16.\.\d+\.\d+\.\d+)*
... View more
| makeresults
|eval string="Jan 2 20:29:35 10.10.10.10 -: SampleLog%%1428 # MINOR # jegan # SSO # User login # SSO # Success # User login successful.#"
| rex mode=sed field=string "s/\#*$//"
| rex field=string "(?<message>[^\#]*$)"
| table string message
Explanation :
| rex mode=sed field=string "s/\#*$//" -> replaces the last # with nothing
| rex field=string "(?<message>[^\#]*$)" -> captures everything after the last # and dumps it in a new field 'message'
... View more
Does this help ?
| makeresults
| eval email="recipient1234@gmail.com"
| rex field=email "(?<username>[A-Za-z]+\d{3,})\@(?<domain>\S+)"
| table email username domain
[A-Za-z]+\d{3,} -> will find a string with upper case or lower case characters followed by three or more numbers and will extract it to the field username
\S+ -> Captures anything but a white space after the @ and extracts it to the dield domain
... View more
seems to be working fine for me
run this search - string is your sample log
| makeresults
| eval string="SHA: 829d93a28c73a03e832201de5159994, File: Time: 1537775701 details[File Analysis ]"
|rex field=string "SHA:\s(?<SHA>[^\,\"]+)\,\sFile:\s(?<File>.*?)Time:\s(?<Time>\d+)\s.+"
| table SHA File Time
... View more
|makeresults
|eval string="The team performs checks for the following dashboards"
| rex field=string "(?<output>\w+\s+\w+\s+\w+\s+\w+).+"
... View more
the if statement will return 1 if the fields match else it will return 0
| eval match=if(field1_foo==field2_foo,1,0)
| where match=1
If you want to set an alert - save the search where 'match=1' (to get events where the fields are same) as an alert where you can schedule it to run periodically or create a correlation search in Splunk ES to create a notable event.
... View more
Try adding this regex to your search
| rex field=Properties.Response "\{\"Id\":\"(?<Id>\d+)\",\"Reference\":\"(?<Reference>[^\"]+)\",\"IsFallback\":(?<IsFallback>[^\,]+)\,\"RegistrationDate\":\"(?<RegistrationDate>[^\"]+)\",\"ErrorResult\":(?<ErrorResult>[^\}]+)"
| table Properties.Response Id Reference IsFallback RegistrationDate ErrorResult
... View more
if you convert the string to integer, it will get rid of the leading zeros
| makeresults
| eval String="00147"
| eval StringInt = tonumber(String)
| table String StringInt
Else if you want to keep it as a string, you can try using this regex
| makeresults
| eval String="00147"
|rex field=String "(?<Output>[^0+]\S+)"
| table String Output
... View more
yeah, all you have to use is
index=index1 OR index=index2
| eval field1Index1New =case(field1Index1=field1Index2,field1Index1,field1Index2=field1Index1,field2Index1,1=0,0)
| where field1Index1New!=""
| table field2Index1 field1Index1New
... View more
Can you try this ?
This will return results only if field1Index1=field1Index2
| makeresults
| eval field1Index1= 4
| eval field2Index1= 7
| eval field1Index2= 4
| eval field1Index1New =case(field1Index1=field1Index2,field1Index1,field1Index2=field1Index1,field2Index1,1=0,0)
| where field1Index1New!=""
| table field2Index1 field1Index1New
... View more
if you are trying to delete duplicates
eg:
2018-12-27 13:14:08 host
2018-12-27 13:14:08 host
you can use - | dedup _time host (you will have just 1 event left)
if you are trying to completely exclude the events, try using
| stats dc(host) as count by _time | where count =1
... View more
Thanks for the tip about entering the string as a code.
If the string is going to be 'is/are' always you are right (this wont work).
I was guessing it would be either 'is' or 'are' based on the number of threads.
... View more
The above regex should work , but this should take care of the singular / plural aspect of the number of threads - Please remove spaces before msec and threads in the regular expression below.
"approximately\s+(?< msec>\d+).*?[is|are]\s+(?< threads>\d+)"
... View more