<?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 Use source path time when ingesting data in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/678902#M113456</link>
    <description>&lt;P&gt;I have the following source .I want to extract time from source when data is ingesting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;source="/logs/gs/ute-2024-02-05a/2024-02-05_16-17-54/abc.log"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in props&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TRANSFORMS-set_time =source_path_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In transforms&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[set_time_from_file_path]
INGEST_EVAL = | eval _time = strptime(replace(source, ".*/ute-(\\d{4}-\\d{2}-\\d{2}[a-z])/([^/]+/[^/]+).*","\1"),"%y-%m-%d_%H-%M-%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried testing it but I am unable to get the _time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval source="/logs/gs/ute-2024-02-05a/2024-02-05_16-17-54/abc.log" 
| fields - _time
``` above set test data ```
| eval _time = strptime(replace(source, ".*/compute-(\\d{4}-\\d{2}-\\d{2}[a-z])/([^/]+/[^/]+).*","\1"),"%y-%m-%d_%H-%M-%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 21:15:03 GMT</pubDate>
    <dc:creator>power12</dc:creator>
    <dc:date>2024-02-27T21:15:03Z</dc:date>
    <item>
      <title>Use source path time when ingesting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/678902#M113456</link>
      <description>&lt;P&gt;I have the following source .I want to extract time from source when data is ingesting&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;source="/logs/gs/ute-2024-02-05a/2024-02-05_16-17-54/abc.log"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in props&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;TRANSFORMS-set_time =source_path_time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In transforms&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[set_time_from_file_path]
INGEST_EVAL = | eval _time = strptime(replace(source, ".*/ute-(\\d{4}-\\d{2}-\\d{2}[a-z])/([^/]+/[^/]+).*","\1"),"%y-%m-%d_%H-%M-%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried testing it but I am unable to get the _time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval source="/logs/gs/ute-2024-02-05a/2024-02-05_16-17-54/abc.log" 
| fields - _time
``` above set test data ```
| eval _time = strptime(replace(source, ".*/compute-(\\d{4}-\\d{2}-\\d{2}[a-z])/([^/]+/[^/]+).*","\1"),"%y-%m-%d_%H-%M-%S")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 21:15:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/678902#M113456</guid>
      <dc:creator>power12</dc:creator>
      <dc:date>2024-02-27T21:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: Use source path time when ingesting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/678913#M113457</link>
      <description>&lt;P&gt;Your props is not matching the stanza name of transforms. Not sure if that was a typo...&lt;BR /&gt;About a typo, you don't need that first pipe in the ingest_eval. Try this instead (I changed the regex a bit)&lt;BR /&gt;&lt;BR /&gt;Props.conf:&lt;BR /&gt;&lt;SPAN&gt;[your_sourcetype]&lt;BR /&gt;TRANSFORMS-set_time = set_time_from_file_path&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Transforms.conf&lt;BR /&gt;[set_time_from_file_path]&lt;BR /&gt;INGEST_EVAL = eval _time = strptime(replace(source, ".*/ute-(\\d{4}-\\d{2}-\\d{2}[a-z]+)/([^/]+/[^/]+).*","\\1"), "%Y-%m-%d_%H-%M-%S")&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 02:52:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/678913#M113457</guid>
      <dc:creator>victor_menezes</dc:creator>
      <dc:date>2024-02-28T02:52:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use source path time when ingesting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/679009#M113474</link>
      <description>&lt;P&gt;Thank You&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/140738"&gt;@victor_menezes&lt;/a&gt;&amp;nbsp; .I tried below and it worked .&lt;BR /&gt;&lt;BR /&gt;| eval _time = strptime(replace(source, ".*(\d\d\d\d-\d\d-\d\d\_\d\d-\d\d-\d\d).*","\1"),"%Y-%m-%d_%H-%M-%S")&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 14:59:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/679009#M113474</guid>
      <dc:creator>power12</dc:creator>
      <dc:date>2024-02-28T14:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use source path time when ingesting data</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/679017#M113475</link>
      <description>&lt;P&gt;Awesome! Glad to know that.&lt;BR /&gt;&lt;BR /&gt;Please remember to mark this as resolved so others can know about it.&lt;BR /&gt;&lt;BR /&gt;Happy splunking!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Feb 2024 15:30:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Use-source-path-time-when-ingesting-data/m-p/679017#M113475</guid>
      <dc:creator>victor_menezes</dc:creator>
      <dc:date>2024-02-28T15:30:43Z</dc:date>
    </item>
  </channel>
</rss>

