<?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 combine results from 2 servers into 1 combined field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152517#M42724</link>
    <description>&lt;P&gt;Basic search and stats.&lt;/P&gt;

&lt;P&gt;This just counts events by the Action in the event (Failure, Success, etc)&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | stats count by Action&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If you have the number of failures in a field:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | stats sum(failure_count_field) by Action&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 22 Nov 2013 16:06:50 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2013-11-22T16:06:50Z</dc:date>
    <item>
      <title>How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152516#M42723</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Is there a way to combine the results for 2 different servers (DNS names) into a third field that becomes the 'combined' field?  For example, a search returns the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Dest      Action    Total
Server1   Failure   10
Server2   Failure   20
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I combine the results from Server 1 and Server 2 into a new field called Server3 (the combined field) to return the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Dest      Action    Total
Server3   Failure   30
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The reason I ask is because Server1 and Server2 are really the same server.  Server1 is the internal interface and Server2 is the external interface.  However, these DNS names are treated as 2 different servers in Splunk and I'd like to combine the Totals that I'm tracking in my dashboards into a new "Server3" field.  I hope this makes sense.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 15:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152516#M42723</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2013-11-22T15:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152517#M42724</link>
      <description>&lt;P&gt;Basic search and stats.&lt;/P&gt;

&lt;P&gt;This just counts events by the Action in the event (Failure, Success, etc)&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | stats count by Action&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If you have the number of failures in a field:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | stats sum(failure_count_field) by Action&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:06:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152517#M42724</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-22T16:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152518#M42725</link>
      <description>&lt;P&gt;Thanks, but in my results, I have many other servers so I can't simply count by action.  What I'd like to do is combine the results for 2 specific server names only... and leave the rest alone.  Something like Server1+Server2=Server3.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:13:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152518#M42725</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2013-11-22T16:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152519#M42726</link>
      <description>&lt;P&gt;You have only two servers in your logs or there could be other servers which have just one instance?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152519#M42726</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2013-11-22T16:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152520#M42727</link>
      <description>&lt;P&gt;try this: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;your_search | eval new_host = case(host=="Server1","Server3",host=="Server2","Server3",1=1,host) | stats count by Action new_host&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:15:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152520#M42727</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-22T16:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152521#M42728</link>
      <description>&lt;P&gt;There are many other servers... so I need to peel out Server1 and Server2 (since they are the same server) and put them into a new result Server3...&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:16:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152521#M42728</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2013-11-22T16:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152522#M42729</link>
      <description>&lt;P&gt;So here's my search along with my attempt of the suggested eval and it didn't work... you'll see that I'm trying to combine "MAIL001" and MAIL002" into "MAIL".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;action=failure `authentication` | eval MAIL=case(host=="MAIL001",host=="MAIL002",1=1,host) | stats dc(_raw) as Total by user,src,dest,app,action | sort -Total
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Nov 2013 16:32:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152522#M42729</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2013-11-22T16:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152523#M42730</link>
      <description>&lt;P&gt;You are missing sections of your case statement. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;action=failure 'authentication' | eval new_host = case("host=="MAIL001","MAIL",host=="MAIL002","MAIL",1=1,host) | stats dc(_raw) as Total by user, src,dest,app,action,new_host | sort -Total&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 17:05:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152523#M42730</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2013-11-22T17:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152524#M42731</link>
      <description>&lt;P&gt;Thanks, I think you got me on the right track &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;  I'll play around with this eval statement.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 18:25:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152524#M42731</guid>
      <dc:creator>echojacques</dc:creator>
      <dc:date>2013-11-22T18:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to combine results from 2 servers into 1 combined field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152525#M42732</link>
      <description>&lt;P&gt;An alternate way to accomplish your goal is to create a lookup table which offers an alias for the servers you have identified. For instance, consider a case in which you have multiple servers in your data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Fri Nov 22 12:09:01 EST 2013 Dest=Server1 Action=Failure
Fri Nov 22 12:10:01 EST 2013 Dest=Server2 Action=Failure
Fri Nov 22 12:11:01 EST 2013 Dest=Server4 Action=Failure
Fri Nov 22 12:12:01 EST 2013 Dest=Server5 Action=Failure
Fri Nov 22 12:13:01 EST 2013 Dest=Server1 Action=Failure
Fri Nov 22 12:14:01 EST 2013 Dest=Server2 Action=Failure
Fri Nov 22 12:15:01 EST 2013 Dest=Server4 Action=Failure
Fri Nov 22 12:16:01 EST 2013 Dest=Server5 Action=Failure
Fri Nov 22 12:17:01 EST 2013 Dest=Server1 Action=Failure
Fri Nov 22 12:18:01 EST 2013 Dest=Server2 Action=Failure
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When you enumerate the data in Splunk you see the results based on the data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test Action="Failure" sourcetype="test-1385147713"
| stats count by Dest Action
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/Untitled2001.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Let's say that you create a lookup table with the alias for the targeted servers:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Dest,Name
Server2,Server3
Server1,Server3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;You instantiate this by creating the CSV file under $SPLUNK_HOME\etc\apps\search\lookups\. In this case we name that file server_alias.csv. &lt;/P&gt;

&lt;P&gt;We complement that with an entry in props.conf and transforms.conf as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf
[test-1385147713]
LOOKUP-server_aliases = server_aliases Dest AS Dest OUTPUTNEW

# transforms.conf
[server_aliases]
default_match = NULL
filename = server_aliases.csv
min_matches = 1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can do all of this work through the SplunkWeb GUI. If you prefer to do that way, please follow the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Knowledge/Usefieldlookupstoaddinformationtoyourevents"&gt;guidelines in our documentation&lt;/A&gt;.&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;You would then use a quick trick to enumerate the value like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test Action="Failure" sourcetype="test-1385147713"
| eval Name=if(Name="NULL",Dest,Name)
| stats count by Name Action
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;IMG src="http://answers.splunk.com//storage/Untitled2000_1.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;This is now a fairly easy and flexible way to achieve your initial goal.&lt;/P&gt;

&lt;P&gt;-gc&lt;/P&gt;</description>
      <pubDate>Fri, 22 Nov 2013 21:21:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-combine-results-from-2-servers-into-1-combined-field/m-p/152525#M42732</guid>
      <dc:creator>Gilberto_Castil</dc:creator>
      <dc:date>2013-11-22T21:21:30Z</dc:date>
    </item>
  </channel>
</rss>

