Splunk Search

How to use rex to extract only the date field?

New Member

hi everyone

my log is: 2017-03-07T14:21:17.061-0600,,0,,,,,1,0,0,0,** 1753-01-01 00:00:00.0000000**,0,1753-01-01 00:00:00.0000000,, and I need

1.- In the bolded portion of the log, how can I use rex to extract only yyyy-mm-dd (1753-01-01, a normal date format)?
2.- when I have 1753 in my logs, how to show empty or Null?

thank yo very much

0 Karma


Try this

| rex ",.*?\s(?<myDate>\d{4}-\d{2}-\d{2})\s"
| replace "1753*" with "*" in myDate
0 Karma