<?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 how do I manipulate string data in tstats results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230502#M68330</link>
    <description>&lt;P&gt;I am trying to get all DHCP records for machines on which an authentication attempt was made for a user.  I am doing this with a subsearch on the Authentication datamodel for the authentication sources.&lt;BR /&gt;&lt;BR /&gt;
One thing that I noticed is that sometimes my authentication info has the machine name, while other times it has the IP Address source, but prepended with "::ffff:"&lt;BR /&gt;
That extra bit at the front makes the source unfindable in DHCP logs.   Is there a way for my tstats result to remove the "::ffff:"&lt;/P&gt;

&lt;P&gt;I have tried&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|tstats count FROM datamodel=Authentication WHERE Authentication.user="&amp;lt;user&amp;gt;"  Authentication.action="failure" by Authentication.src | eval src=ltrim(Authentication.src,"::ffff:") | fields src
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for which I end up with an empty field called src&lt;/P&gt;

&lt;P&gt;and (longshot)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|tstats count FROM datamodel=Authentication WHERE Authentication.user="userName"  Authentication.action="failure" by ltrim(Authentication.src,"::ffff:")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which give me the error Error in 'tstats' command: Invalid argument: '::ffff:)'&lt;/P&gt;

&lt;P&gt;if it matters, here is the larger query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DhcpSrvLog  "DNS Update Successful" [|tstats count FROM datamodel=Authentication WHERE Authentication.user="userName" Authentication.action="failure" by Authentication.src | rename Authentication.src as search]  | table time dest dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Jan 2017 17:25:55 GMT</pubDate>
    <dc:creator>MonkeyK</dc:creator>
    <dc:date>2017-01-16T17:25:55Z</dc:date>
    <item>
      <title>how do I manipulate string data in tstats results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230502#M68330</link>
      <description>&lt;P&gt;I am trying to get all DHCP records for machines on which an authentication attempt was made for a user.  I am doing this with a subsearch on the Authentication datamodel for the authentication sources.&lt;BR /&gt;&lt;BR /&gt;
One thing that I noticed is that sometimes my authentication info has the machine name, while other times it has the IP Address source, but prepended with "::ffff:"&lt;BR /&gt;
That extra bit at the front makes the source unfindable in DHCP logs.   Is there a way for my tstats result to remove the "::ffff:"&lt;/P&gt;

&lt;P&gt;I have tried&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|tstats count FROM datamodel=Authentication WHERE Authentication.user="&amp;lt;user&amp;gt;"  Authentication.action="failure" by Authentication.src | eval src=ltrim(Authentication.src,"::ffff:") | fields src
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for which I end up with an empty field called src&lt;/P&gt;

&lt;P&gt;and (longshot)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|tstats count FROM datamodel=Authentication WHERE Authentication.user="userName"  Authentication.action="failure" by ltrim(Authentication.src,"::ffff:")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which give me the error Error in 'tstats' command: Invalid argument: '::ffff:)'&lt;/P&gt;

&lt;P&gt;if it matters, here is the larger query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=DhcpSrvLog  "DNS Update Successful" [|tstats count FROM datamodel=Authentication WHERE Authentication.user="userName" Authentication.action="failure" by Authentication.src | rename Authentication.src as search]  | table time dest dest_ip
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jan 2017 17:25:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230502#M68330</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-01-16T17:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: how do I manipulate string data in tstats results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230503#M68331</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|tstats count FROM datamodel=Authentication WHERE Authentication.user="&amp;lt;user&amp;gt;"  Authentication.action="failure" by Authentication.src | eval src=replace('Authentication.src',"::ffff:","") | fields src
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jan 2017 17:29:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230503#M68331</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-16T17:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: how do I manipulate string data in tstats results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230504#M68332</link>
      <description>&lt;P&gt;Perfect. that does it!  I guess that I need the field name in single quotes.  Did not realize that.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 22:14:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230504#M68332</guid>
      <dc:creator>MonkeyK</dc:creator>
      <dc:date>2017-01-16T22:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: how do I manipulate string data in tstats results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230505#M68333</link>
      <description>&lt;P&gt;Yes, for field names which contains special characters like colon, dot, space etc (underscore is fine).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 22:29:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-do-I-manipulate-string-data-in-tstats-results/m-p/230505#M68333</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-01-16T22:29:34Z</dc:date>
    </item>
  </channel>
</rss>

