<?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: Using regex syntax to trim timestamp in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584819#M203718</link>
    <description>&lt;P&gt;What is the use case for string manipulation if this concerns event timestamp (designated by builtin _time field)? &amp;nbsp;Most of the time, using "| bin span=1h@h _time" allows better handling/flexibility down the pipe, perhaps better performance, too.&lt;/P&gt;&lt;P&gt;If this concerns a text field that is not used as event timestamp, an alternative to regex is&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#split.28X.2C.22Y.22.29" target="_blank" rel="noopener"&gt;split()&lt;/A&gt;, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date_hour = mvindex(split(timestamp, ":"), 0)&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 12 Feb 2022 01:52:45 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2022-02-12T01:52:45Z</dc:date>
    <item>
      <title>Using regex syntax to trim timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584806#M203712</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Using regex, what is the syntax, to trim a timestamp formatted like&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;2022-01-06 01:51:23 UTC&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;so that it only reflects the date and hour, like this&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;2022-01-06 01&lt;/STRONG&gt;&lt;SPAN&gt;?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 20:13:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584806#M203712</guid>
      <dc:creator>bjs</dc:creator>
      <dc:date>2022-02-11T20:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex syntax to trim timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584808#M203713</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex mode=sed "s/(?&amp;lt;datehour&amp;gt;\d{4}-\d\d-\d\d \d\d)(?&amp;lt;discard&amp;gt;:\d\d:\d\d \w+)/\\1/g"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 11 Feb 2022 21:42:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584808#M203713</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-02-11T21:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex syntax to trim timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584812#M203715</link>
      <description>&lt;P&gt;I was actually able to change the event timestamp by using offset:&amp;nbsp;&lt;SPAN&gt;| rex field=timestamp "(?&amp;lt;timestamp&amp;gt;.{13})"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Feb 2022 22:30:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584812#M203715</guid>
      <dc:creator>bjs</dc:creator>
      <dc:date>2022-02-11T22:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex syntax to trim timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584819#M203718</link>
      <description>&lt;P&gt;What is the use case for string manipulation if this concerns event timestamp (designated by builtin _time field)? &amp;nbsp;Most of the time, using "| bin span=1h@h _time" allows better handling/flexibility down the pipe, perhaps better performance, too.&lt;/P&gt;&lt;P&gt;If this concerns a text field that is not used as event timestamp, an alternative to regex is&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/MultivalueEvalFunctions#split.28X.2C.22Y.22.29" target="_blank" rel="noopener"&gt;split()&lt;/A&gt;, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval date_hour = mvindex(split(timestamp, ":"), 0)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Feb 2022 01:52:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584819#M203718</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-02-12T01:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using regex syntax to trim timestamp</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584861#M203740</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults
| eval time= = 2022-01-06 01:51:23 UTC"
| eval time = replace(time, "\s.*$", "")&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Feb 2022 19:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-regex-syntax-to-trim-timestamp/m-p/584861#M203740</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2022-02-12T19:37:55Z</dc:date>
    </item>
  </channel>
</rss>

