<?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: Converting  variable File Size Units with dot points  to bytes in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567535#M197791</link>
    <description>&lt;P data-unlink="true"&gt;Thanks for the quick response - using &lt;A href="https://convertlive.com/u/convert/kilobytes/to/bytes" target="_self"&gt;this website&lt;/A&gt;&amp;nbsp;the conversions are accurate.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is a link to the app in development:&amp;nbsp;&lt;A href="https://github.com/satiex/splunk_synology_TA" target="_blank"&gt;https://github.com/satiex/splunk_synology_TA&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Does anyone know how I can get these conversions to happen at index time? I've tried a few things with the props.conf and transforms.conf without any luck.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is an example of a log event:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sep 19 13:19:54 172.17.0.1 Sep 19 13:19:54 SYN-NAS WinFileService Event: read, Path: /Shows/TV Show/Season 1/Episode 1 - Pilot.mkv, File/Folder: File, Size: 1.23 GB, User: john.smith@ldap.local.com, IP: 192.168.1.59&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;And here is the REGEX in the transforms.conf:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[synology_ft_basefields]
REGEX = \sWinFileService Event:\s(?&amp;lt;action&amp;gt;create|write|read|delete|rename),\sPath:\s(?&amp;lt;path&amp;gt;.+?(?=,)),\sFile\/Folder:\s(?&amp;lt;file_folder&amp;gt;File|Folder),\sSize:\s(?&amp;lt;sizeValue&amp;gt;[\d.]+)\s?(?&amp;lt;sizeUnit&amp;gt;\w*),\sUser:\s(?&amp;lt;user&amp;gt;[^\,]*),\sIP:\s(?&amp;lt;src_ip&amp;gt;[[ipv4]])&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 19 Sep 2021 05:48:44 GMT</pubDate>
    <dc:creator>satiex</dc:creator>
    <dc:date>2021-09-19T05:48:44Z</dc:date>
    <item>
      <title>Converting  variable File Size Units with dot points  to bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567497#M197774</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I am building a Synology Splunk TA to share with the community. In the logs, file sizes can be presented in many different units:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;1.72 KB
2.35 KB
0 Bytes
75.08 KB
243.00 KB
18.62 MB
261.62 KB
48.60 GB&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been stuck trying to convert all of these values to bytes.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Splunk-Search/Convert-B-KB-MB-GB-into-bytes-without-a-unit/m-p/283585" target="_self"&gt;This post&lt;/A&gt; was really helpful in using regex and eval statements, but does not consider the added complexity of have decimal places.&lt;/P&gt;&lt;P&gt;Any assistance is appreciated and will be credited in the App.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Sep 2021 04:25:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567497#M197774</guid>
      <dc:creator>satiex</dc:creator>
      <dc:date>2021-09-18T04:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Converting  variable File Size Units with dot points  to bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567504#M197777</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="1.72 KB
2.35 KB
0 Bytes
75.08 KB
243.00 KB
18.62 MB
261.62 KB
48.60 GB" 
| multikv noheader=t 
| rex "^(?&amp;lt;Value&amp;gt;[\d.]+)\s?(?&amp;lt;Unit&amp;gt;\w*)$" 
| eval factor=case(Unit="B",1,Unit="KB",1024,Unit="MB",1024*1024,Unit="GB",1024*1024*1024,Unit="TB",11024*1024*1024*1024,true(),1) 
| eval InBytes=Value*factor
| table _raw InBytes&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 18 Sep 2021 09:32:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567504#M197777</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-18T09:32:44Z</dc:date>
    </item>
    <item>
      <title>Re: Converting  variable File Size Units with dot points  to bytes</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567535#M197791</link>
      <description>&lt;P data-unlink="true"&gt;Thanks for the quick response - using &lt;A href="https://convertlive.com/u/convert/kilobytes/to/bytes" target="_self"&gt;this website&lt;/A&gt;&amp;nbsp;the conversions are accurate.&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is a link to the app in development:&amp;nbsp;&lt;A href="https://github.com/satiex/splunk_synology_TA" target="_blank"&gt;https://github.com/satiex/splunk_synology_TA&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Does anyone know how I can get these conversions to happen at index time? I've tried a few things with the props.conf and transforms.conf without any luck.&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Here is an example of a log event:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Sep 19 13:19:54 172.17.0.1 Sep 19 13:19:54 SYN-NAS WinFileService Event: read, Path: /Shows/TV Show/Season 1/Episode 1 - Pilot.mkv, File/Folder: File, Size: 1.23 GB, User: john.smith@ldap.local.com, IP: 192.168.1.59&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;And here is the REGEX in the transforms.conf:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[synology_ft_basefields]
REGEX = \sWinFileService Event:\s(?&amp;lt;action&amp;gt;create|write|read|delete|rename),\sPath:\s(?&amp;lt;path&amp;gt;.+?(?=,)),\sFile\/Folder:\s(?&amp;lt;file_folder&amp;gt;File|Folder),\sSize:\s(?&amp;lt;sizeValue&amp;gt;[\d.]+)\s?(?&amp;lt;sizeUnit&amp;gt;\w*),\sUser:\s(?&amp;lt;user&amp;gt;[^\,]*),\sIP:\s(?&amp;lt;src_ip&amp;gt;[[ipv4]])&lt;/LI-CODE&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Sep 2021 05:48:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Converting-variable-File-Size-Units-with-dot-points-to-bytes/m-p/567535#M197791</guid>
      <dc:creator>satiex</dc:creator>
      <dc:date>2021-09-19T05:48:44Z</dc:date>
    </item>
  </channel>
</rss>

