<?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: How to change the value of a field with information from another field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208062#M60660</link>
    <description>&lt;P&gt;Try like this (Assuming 'one phone number must and only belongs to one user' is true)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving UserID and phoneNumber field | eventstats values(UserID) as UserForPhone by phoneNumber | eval phoneNumber = UserForPhone. "-" .phoneNumber | fields - UserForPhone 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 14 Jun 2016 15:41:04 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-06-14T15:41:04Z</dc:date>
    <item>
      <title>How to change the value of a field with information from another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208060#M60658</link>
      <description>&lt;P&gt;Suppose that there is a log with two fields, userName and phoneNumber, the structure is like:&lt;/P&gt;

&lt;P&gt;userName |   phoneNumber&lt;BR /&gt;
      A           |         0111&lt;BR /&gt;
      A            |        0222&lt;BR /&gt;
                   |         0111&lt;BR /&gt;
      B           |         0333&lt;BR /&gt;
                   |          0222&lt;BR /&gt;
                     |        0333&lt;BR /&gt;
Namely, one phone number must and only belongs to one user. In some events, both two fields would appear but in other events, only phoneNumber field exists.&lt;BR /&gt;
My question is, how to correlate each phone number with a particular user name, so that I can understand who has the number without depending on user name fields? I expect the new fields would like this:&lt;/P&gt;

&lt;P&gt;userName  |  phoneNumber&lt;BR /&gt;
      A            |         A, 0111&lt;BR /&gt;
      A            |         A, 0222&lt;BR /&gt;
                    |       &lt;STRONG&gt;A, 0111&lt;/STRONG&gt;&lt;BR /&gt;
      B             |        B, 0333&lt;BR /&gt;
                    |        &lt;STRONG&gt;A, 0222&lt;BR /&gt;
                     |       B, 0333&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;It's quite easy if both fields exist in one event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval phoneNumber = UserID. "-" .phoneNumber |
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But how to make this change work for events without userName field?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 06:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208060#M60658</guid>
      <dc:creator>Tachines</dc:creator>
      <dc:date>2016-06-14T06:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the value of a field with information from another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208061#M60659</link>
      <description>&lt;P&gt;Do you have any other source of data that will contain the username and their phone number? This sounds like a data quality issue. If you can find that information somewhere else you definitely have some options we can help you with.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 13:12:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208061#M60659</guid>
      <dc:creator>ryanoconnor</dc:creator>
      <dc:date>2016-06-14T13:12:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the value of a field with information from another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208062#M60660</link>
      <description>&lt;P&gt;Try like this (Assuming 'one phone number must and only belongs to one user' is true)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving UserID and phoneNumber field | eventstats values(UserID) as UserForPhone by phoneNumber | eval phoneNumber = UserForPhone. "-" .phoneNumber | fields - UserForPhone 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jun 2016 15:41:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208062#M60660</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-06-14T15:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to change the value of a field with information from another field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208063#M60661</link>
      <description>&lt;P&gt;That's it! It works well. The only thing is that I guess there are some minor problems in my logs, because sometimes a phone number matches 2 users, which it shouldn't.&lt;/P&gt;

&lt;P&gt;Could you explain a bit why your answer can apply one to many mapping to all events, and, why it doesn't work if a number points to mutiple names (when this happens, phoneNumber field for that event will disappear actually).&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 01:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-the-value-of-a-field-with-information-from-another/m-p/208063#M60661</guid>
      <dc:creator>Tachines</dc:creator>
      <dc:date>2016-06-15T01:14:14Z</dc:date>
    </item>
  </channel>
</rss>

