<?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: Extract first characters of field if in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531301#M36123</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228757"&gt;@marco_massari11&lt;/a&gt;&amp;nbsp;&amp;nbsp;Try below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval site=case(substr(Device,1,7)=="mysite1",substr(Device, -4),1=1,substr(Device,1,7) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Nov 2020 10:09:23 GMT</pubDate>
    <dc:creator>493669</dc:creator>
    <dc:date>2020-11-30T10:09:23Z</dc:date>
    <item>
      <title>Extract first characters of field if</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531298#M36122</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I need to extract first 7 characters of&amp;nbsp; a network device name, like this:&lt;/P&gt;&lt;P&gt;| eval site=substr(Device,1,7)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;to identify the site&lt;/P&gt;&lt;P&gt;But if the the first 7 characters are equals to site=mysite1 I need also the last 4 charatcters of the device name:&lt;/P&gt;&lt;P&gt;&amp;nbsp;| substr(Device, -4)&lt;/P&gt;&lt;P&gt;If the first 7 characters are !=mysite1 I don't need the last 4&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I merge those conditions in a unique field? beacause at the end of the query I have :&lt;/P&gt;&lt;P&gt;| chart count(Interface) as Interfaces by site&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;so I need only one eval site field&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 09:50:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531298#M36122</guid>
      <dc:creator>marco_massari11</dc:creator>
      <dc:date>2020-11-30T09:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Extract first characters of field if</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531301#M36123</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/228757"&gt;@marco_massari11&lt;/a&gt;&amp;nbsp;&amp;nbsp;Try below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval site=case(substr(Device,1,7)=="mysite1",substr(Device, -4),1=1,substr(Device,1,7) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 10:09:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531301#M36123</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2020-11-30T10:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: Extract first characters of field if</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531302#M36124</link>
      <description>&lt;P&gt;If the first 7 characters are equal to mysite1, the query takes only the last 4 characters, but I need the first 7 and the last 4. So the solution is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval site=case(substr(Device,1,7)=="mysite1",substr(Device1 , 7) + substr(Device, -4),1=1,substr(Device,1,7) )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; Thanksss!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Nov 2020 10:39:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Extract-first-characters-of-field-if/m-p/531302#M36124</guid>
      <dc:creator>marco_massari11</dc:creator>
      <dc:date>2020-11-30T10:39:05Z</dc:date>
    </item>
  </channel>
</rss>

