<?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 Extract data from a txt file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467327#M131519</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I have the attached file that is generated every night through my client's internal system and I need to index the information to collect metrics.&lt;/P&gt;

&lt;P&gt;I need these files to be indexed based on their date in the file name.&lt;/P&gt;

&lt;P&gt;Ex: The name of the file generated by the system is (qtd_ramal_diario_04042020.txt, qtd_ramal_diario_05042020.txt, etc.), so I need it to be indexed according to the time in the file name.&lt;/P&gt;

&lt;P&gt;I need to extract the information that is between ";" in separate fields with the names (Field1, Field2, Field3) respectively.&lt;/P&gt;

&lt;P&gt;Remembering that this file is variable, there are days that generate many lines and others do not.&lt;/P&gt;

&lt;P&gt;FIELD1 FIELD2 FIELD3&lt;BR /&gt;
77111010; 8; 614&lt;BR /&gt;
77111812; 1; 106&lt;BR /&gt;
77115070; 1; 58&lt;BR /&gt;
70666287; 4; 171&lt;BR /&gt;
70662245; 12; 708&lt;BR /&gt;
77196074; 23; 1439&lt;/P&gt;

&lt;P&gt;Is there a way to do this with Splunk?&lt;/P&gt;

&lt;P&gt;Below is an example of the generated log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;78122960;2; 132
55002801;3; 279
 8068256;8; 466
80661008;4; 134
55258888; 21;1843
76283160;1;25
55735555; 15;1027
55191240;1; 267
80662176;2; 249
 790965034;3;93
55159608;1;20
80668021;1;19
76282680;2; 154
80664441;5; 536
71172794;1;28
55196157; 16;1208
55192425;3; 347
55196091;1;23
55192404;1;71
55196032; 24; 996
55196553;2;78
55196040;4;1087
55196426;1; 152
78111816;2; 157
78111847;1;30
78111815;6; 429
78111814;3; 233
55021902;2; 278
55034140;4; 159
 550364331;1;80
 550561127;2;78
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:53:08 GMT</pubDate>
    <dc:creator>leandromatperei</dc:creator>
    <dc:date>2020-09-30T04:53:08Z</dc:date>
    <item>
      <title>Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467327#M131519</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;

&lt;P&gt;I have the attached file that is generated every night through my client's internal system and I need to index the information to collect metrics.&lt;/P&gt;

&lt;P&gt;I need these files to be indexed based on their date in the file name.&lt;/P&gt;

&lt;P&gt;Ex: The name of the file generated by the system is (qtd_ramal_diario_04042020.txt, qtd_ramal_diario_05042020.txt, etc.), so I need it to be indexed according to the time in the file name.&lt;/P&gt;

&lt;P&gt;I need to extract the information that is between ";" in separate fields with the names (Field1, Field2, Field3) respectively.&lt;/P&gt;

&lt;P&gt;Remembering that this file is variable, there are days that generate many lines and others do not.&lt;/P&gt;

&lt;P&gt;FIELD1 FIELD2 FIELD3&lt;BR /&gt;
77111010; 8; 614&lt;BR /&gt;
77111812; 1; 106&lt;BR /&gt;
77115070; 1; 58&lt;BR /&gt;
70666287; 4; 171&lt;BR /&gt;
70662245; 12; 708&lt;BR /&gt;
77196074; 23; 1439&lt;/P&gt;

&lt;P&gt;Is there a way to do this with Splunk?&lt;/P&gt;

&lt;P&gt;Below is an example of the generated log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;78122960;2; 132
55002801;3; 279
 8068256;8; 466
80661008;4; 134
55258888; 21;1843
76283160;1;25
55735555; 15;1027
55191240;1; 267
80662176;2; 249
 790965034;3;93
55159608;1;20
80668021;1;19
76282680;2; 154
80664441;5; 536
71172794;1;28
55196157; 16;1208
55192425;3; 347
55196091;1;23
55192404;1;71
55196032; 24; 996
55196553;2;78
55196040;4;1087
55196426;1; 152
78111816;2; 157
78111847;1;30
78111815;6; 429
78111814;3; 233
55021902;2; 278
55034140;4; 159
 550364331;1;80
 550561127;2;78
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:53:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467327#M131519</guid>
      <dc:creator>leandromatperei</dc:creator>
      <dc:date>2020-09-30T04:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467328#M131520</link>
      <description>&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[delim_csv]
DATETIME_CONFIG = NONE
FIELD_DELIMITER = ;
FIELD_NAMES = field1,field2,field3
LINE_BREAKER = ([\r\n]+)
NO_BINARY_CHECK = 1
SHOULD_LINEMERGE = 0
TRANSFORMS-time = timestampeval
pulldown_type = 1
disabled = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[timestampeval]
INGEST_EVAL = _time=strptime(replace(source,".*?(\d+)\.txt","\1"),"%d%m%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please tell me.&lt;BR /&gt;
1. Why don't you provide necessary information from the beginning?&lt;BR /&gt;
2. I have provided reference materials, but did not understand where?&lt;/P&gt;

&lt;P&gt;Occasionally, I think the questioner may not be asking for a solution.&lt;/P&gt;

&lt;P&gt;For example&lt;BR /&gt;
People who just say they don't work&lt;BR /&gt;
People who do not provide the information needed to create a query&lt;/P&gt;

&lt;H2&gt;Please answer me because I want to solve my question.&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="78122960;2; 132
 55002801;3; 279
  8068256;8; 466
 80661008;4; 134
 55258888; 21;1843
 76283160;1;25
 55735555; 15;1027
 55191240;1; 267
 80662176;2; 249
  790965034;3;93
 55159608;1;20
 80668021;1;19
 76282680;2; 154
 80664441;5; 536
 71172794;1;28
 55196157; 16;1208
 55192425;3; 347
 55196091;1;23
 55192404;1;71
 55196032; 24; 996
 55196553;2;78
 55196040;4;1087
 55196426;1; 152
 78111816;2; 157
 78111847;1;30
 78111815;6; 429
 78111814;3; 233
 55021902;2; 278
 55034140;4; 159
  550364331;1;80
  550561127;2;78" 
| multikv noheader=t 
| foreach * 
    [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = trim('&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')] 
| rename Column_* as FIELD* 
| fields - _* linecount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;you can do it by search.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 20:14:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467328#M131520</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-06T20:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467329#M131521</link>
      <description>&lt;P&gt;Thank you for your help.&lt;/P&gt;

&lt;P&gt;This file is generated every day, what would the configuration of &lt;STRONG&gt;props.conf&lt;/STRONG&gt; look like?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 20:41:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467329#M131521</guid>
      <dc:creator>leandromatperei</dc:creator>
      <dc:date>2020-04-06T20:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467330#M131522</link>
      <description>&lt;P&gt;use &lt;CODE&gt;FIELD_DELIMITER&lt;/CODE&gt; in props.conf&lt;/P&gt;</description>
      <pubDate>Mon, 06 Apr 2020 21:18:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467330#M131522</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-06T21:18:42Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467331#M131523</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/184221"&gt;@to4kawa&lt;/a&gt; , I configured the structure below using props.conf and transform.conf, however, the following points did not work:&lt;/P&gt;

&lt;P&gt;My file name maintains a structure "qtd_ramal_diario_DDMMAAAA.txt", for example, the file "qtd_ramal_diario_05042020.txt" needs to be indexed in Splunk on 05/05/2020, how to select how to use this configuration file?&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Another point I need that all the lines of my file are indexed to each of the events in Splunk, sending the complete file for analysis.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;For example, if my file has 200 lines, it needs to be 200 events in Splunk.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;**props.conf**
[linux-nice]
REPORT-fields = commafields

**transforms.conf**
[commafields]
DELIMS = ";"
FIELDS = field1, field2, field3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:53:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467331#M131523</guid>
      <dc:creator>leandromatperei</dc:creator>
      <dc:date>2020-09-30T04:53:24Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467332#M131524</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/s/zfr9g9e6n8hsfzj/qtd_ramal_diario_05042020.txt?dl=0"&gt;https://www.dropbox.com/s/zfr9g9e6n8hsfzj/qtd_ramal_diario_05042020.txt?dl=0&lt;/A&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 13:33:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467332#M131524</guid>
      <dc:creator>leandromatperei</dc:creator>
      <dc:date>2020-04-07T13:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extract data from a txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467333#M131525</link>
      <description>&lt;P&gt;see&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/311452/how-to-use-date-in-filename-as-the-timestamp-for-e.html"&gt;https://answers.splunk.com/answers/311452/how-to-use-date-in-filename-as-the-timestamp-for-e.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 23:34:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-data-from-a-txt-file/m-p/467333#M131525</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-07T23:34:37Z</dc:date>
    </item>
  </channel>
</rss>

