<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to extract date using rex? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579595#M47456</link>
    <description>&lt;P&gt;Thank you sir&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Dec 2021 12:42:35 GMT</pubDate>
    <dc:creator>Kumar2</dc:creator>
    <dc:date>2021-12-30T12:42:35Z</dc:date>
    <item>
      <title>how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531983#M36162</link>
      <description>&lt;P&gt;how to extract date using rex command ? format is&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;time&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;2020-12-04&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN class="t"&gt;01:00"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 09:14:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531983#M36162</guid>
      <dc:creator>avneet26</dc:creator>
      <dc:date>2020-12-04T09:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531986#M36164</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228691"&gt;@avneet26&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;do you want:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;to extract a date field from a log and put it in a field,&lt;/LI&gt;&lt;LI&gt;to parse a date at index time,&lt;/LI&gt;&lt;LI&gt;to display a date in a different format (e.g. from epochtime to your format)?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;At first the date you used as sample is strange because it's a date with the timezone and without the time.&lt;/P&gt;&lt;P&gt;Anyway, in the first case, you can use a regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\"time\":\"(?&amp;lt;time&amp;gt;[^\"]+)\"&lt;/LI-CODE&gt;&lt;P&gt;In the second case the TIME_FORMAT is (only for the date you shared!):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TIME_FORMAT=%Y-%m-%d%:z&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; If you want to display an epochtime date to the format you shared:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval time=strftime(time,"%y-%m-%d%:z")&lt;/LI-CODE&gt;&lt;P&gt;or if you want to transfroma the date you shared in epochtime, the same using "strptime" function.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 09:28:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531986#M36164</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-04T09:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531991#M36166</link>
      <description>&lt;P&gt;Hi.. i want the complete date field . for example i have taken the field&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;time&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;2020-12-04&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN class="t"&gt;01:00" i will to extract starting from 2020 till 01:00 but using the first option you gave its not working. pls help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 09:45:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531991#M36166</guid>
      <dc:creator>avneet26</dc:creator>
      <dc:date>2020-12-04T09:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531992#M36167</link>
      <description>&lt;P&gt;is it possible if we can extract only the date from the time field?&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 09:49:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531992#M36167</guid>
      <dc:creator>avneet26</dc:creator>
      <dc:date>2020-12-04T09:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531995#M36168</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228691"&gt;@avneet26&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;the regex I sent you is correct as you can check at&amp;nbsp;&lt;A href="https://regex101.com/r/GZafMf/1" target="_blank"&gt;https://regex101.com/r/GZafMf/1&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Are you sure about the sample date you share? it's a strange timestamp: date and timezone without time!&lt;/P&gt;&lt;P&gt;Could you share other samples?&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 10:31:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531995#M36168</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-12-04T10:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531996#M36169</link>
      <description>&lt;P&gt;Hi, yes i am sure about the format. can you help me how i can extract only the date from the format i have given example - from field&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;time&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;2020-12-04&lt;/SPAN&gt;&lt;SPAN&gt;+&lt;/SPAN&gt;&lt;SPAN class="t"&gt;01:00" , if i want to extract only 2020-12-04 then how can i do that?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Dec 2020 10:33:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/531996#M36169</guid>
      <dc:creator>avneet26</dc:creator>
      <dc:date>2020-12-04T10:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579580#M47451</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt; Hi sir How to write rex command for this extracting this fields into date and file&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jan 22 06:53 | 21361MA54268.done&lt;/P&gt;&lt;P&gt;Can you please help me .Thanks in Advance&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 10:49:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579580#M47451</guid>
      <dc:creator>Kumar2</dc:creator>
      <dc:date>2021-12-30T10:49:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579585#M47452</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228691"&gt;@avneet26&lt;/a&gt;,&lt;BR /&gt;if you want to extarct the "Time" field, you can use a regex:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "\"time\":\"(?&amp;lt;time&amp;gt;\d+-\d+-\d+)"&lt;/LI-CODE&gt;&lt;P&gt;if instead you want to use it as event timestamp, you have to put in your props.conf:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[your_sourcetype]
TIME_PREFIX =  \"time\":\"
TIME_FORMAT = %Y-%m-%d&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 11:06:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579585#M47452</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-12-30T11:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579588#M47453</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/241218"&gt;@Kumar2&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if you want to extarct the "Time" field, you can use a regex:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "^(?&amp;lt;time&amp;gt;[^\|]+)"&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;if instead you want to use it as event timestamp, you have to put in your props.conf:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[your_sourcetype]
TIME_PREFIX = ^
TIME_FORMAT = %b %d %H:%M&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 11:10:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579588#M47453</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-12-30T11:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579595#M47456</link>
      <description>&lt;P&gt;Thank you sir&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Dec 2021 12:42:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579595#M47456</guid>
      <dc:creator>Kumar2</dc:creator>
      <dc:date>2021-12-30T12:42:35Z</dc:date>
    </item>
    <item>
      <title>Re: how to extract date using rex?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579646#M47462</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/241218"&gt;@Kumar2&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time.&lt;/P&gt;&lt;P&gt;eventually, next time, open a new question, even if similar to another, so you can accept the answer for the other people of Community.&lt;/P&gt;&lt;P&gt;Ciao and happy splunking.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 07:25:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/how-to-extract-date-using-rex/m-p/579646#M47462</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-12-31T07:25:09Z</dc:date>
    </item>
  </channel>
</rss>

