<?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: help in eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147776#M41319</link>
    <description>&lt;P&gt;I see the slash is then probably only missing here because you didn't put everything in a code sample block.&lt;/P&gt;

&lt;P&gt;I did this query to test and then everything is working:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* earliest=-10s@s
| eval colddata="nwfin1swt2 : 2015 Jul 27 23:01:29 CDT: %SATCTRL-FEX101-2-SATCTRL: FEX-101 Module 1: Cold boot" 
| eval restartdata="nwfin2sw1001 26: Jul 27 15:58:36.267: %SYS-CFC7-5-RESTART: System restarted -"
| rex field=colddata "(?i) Module 1: (?&amp;lt;coldboot&amp;gt;\w+\s+\w+)"
| rex field=restartdata "(?i) %SYS-CFC[1-9]-5-RESTART: (?&amp;lt;restart&amp;gt;\w+\s+\w+)"
| eval status=coldboot." ".restart
| table coldboot restart status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you test if that is also working in your environment I did this in Splunk 6.2.3&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jul 2015 11:39:10 GMT</pubDate>
    <dc:creator>aholzel</dc:creator>
    <dc:date>2015-07-30T11:39:10Z</dc:date>
    <item>
      <title>help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147762#M41305</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;Need a help. I have two types of logs.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;nwfin1swt2 : 2015 Jul 27 23:01:29 CDT: %SATCTRL-FEX101-2-SATCTRL: FEX-101 Module 1: Cold boot
nwfin2sw1001 26: Jul 27 15:58:36.267: %SYS-CFC7-5-RESTART: System restarted -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i created a query to list these logs in a table format...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;*swt* "cold boot" OR "system restarted" | rex "(?i) Module 1: (?&amp;lt;coldboot&amp;gt;\w+\s+\w+)" | rex "(?i) %SYS-CFC[1-9]-5-RESTART: (?&amp;lt;restart&amp;gt;\w+\s+\w+)" | eval state=coldboot+restart | table host, state, _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;trying to bring the both results in the column called state with "eval state=coldboot+restart". im not getting in the column state. please help me to sort this out.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host                 state         _time
nwfin1swt2  &amp;nbsp;               2015-07-27 23:01:29
nwfin2sw1001    &amp;nbsp;             2015-07-27 15:58:36.267
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2015 06:32:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147762#M41305</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T06:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147763#M41306</link>
      <description>&lt;P&gt;I assume that you are trying to concatenate the fields "coldboot" and "restart" in the field "state" in that case you need to use a "." and not a "+" to  get them both in "state". Now you are trying to count them.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 08:19:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147763#M41306</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2015-07-30T08:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147764#M41307</link>
      <description>&lt;P&gt;Hi aholze,&lt;/P&gt;

&lt;P&gt;thanks for the reply.&lt;/P&gt;

&lt;P&gt;yes. i tried that as well. eval state = coldboot.restart&lt;/P&gt;

&lt;P&gt;still its not working.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 08:43:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147764#M41307</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T08:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147765#M41308</link>
      <description>&lt;P&gt;i tried state = coldboot." ".restart as well.. no results....&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 08:44:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147765#M41308</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T08:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147766#M41309</link>
      <description>&lt;P&gt;do you get any data if you try them individually?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.... | table host coldboot restart _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and just to be sure you could add the "field=_raw" parameter to the rex command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex field=_raw "YOUR REGEX HERE"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:21:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147766#M41309</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2015-07-30T09:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147767#M41310</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I believe you have to give space after the field names in eval expression.&lt;/P&gt;

&lt;P&gt;swt "cold boot" OR "system restarted" | rex "(?i) Module 1: (?w+s+w+)" | rex "(?i) %SYS-CFC[1-9]-5-RESTART: (?w+s+w+)" | eval state= coldboot + restart | table host, state, _time&lt;/P&gt;

&lt;P&gt;-Krishna Rajapantula.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:23:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147767#M41310</guid>
      <dc:creator>krishnarajapant</dc:creator>
      <dc:date>2015-07-30T09:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147768#M41311</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I believe you have to give space after the field names in eval expression.&lt;/P&gt;

&lt;P&gt;swt "cold boot" OR "system restarted" | rex "(?i) Module 1: (?w+s+w+)" | rex "(?i) %SYS-CFC[1-9]-5-RESTART: (?w+s+w+)" | eval state= coldboot + restart | table host, state, _time&lt;/P&gt;

&lt;P&gt;-Krishna Rajapantula.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:23:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147768#M41311</guid>
      <dc:creator>krishnarajapant</dc:creator>
      <dc:date>2015-07-30T09:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147769#M41312</link>
      <description>&lt;P&gt;Hi Krishna... &lt;/P&gt;

&lt;P&gt;thanks... i tried.. but no output &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147769#M41312</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T09:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147770#M41313</link>
      <description>&lt;P&gt;yes... i'm getting results if i use seperately...concatenation is not working. &lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147770#M41313</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T09:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147771#M41314</link>
      <description>&lt;P&gt;aaaa I think I see it.. in your regex you forgot the slash in front of w+ and s+  so that gives you empty fields.. I tested and this should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;swt "cold boot" OR "system restarted" 
| rex "(?i) Module 1: (?&amp;lt;coldboot&amp;gt;\w+\s+\w+)" 
| rex "(?i) %SYS-CFC[1-9]-5-RESTART: (?&amp;lt;restart&amp;gt;\w+\s+\w+)" 
| eval state=coldboot." ".restart 
| table host, state, _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2015 09:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147771#M41314</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2015-07-30T09:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147772#M41315</link>
      <description>&lt;P&gt;Hi Aholzel,&lt;/P&gt;

&lt;P&gt;the same script only i used earlier.&lt;/P&gt;

&lt;P&gt;eventtype = net &lt;EM&gt;swt&lt;/EM&gt; "cold boot" OR "system restarted" &lt;BR /&gt;
| rex "(?i) Module 1: (?P\w+\s+\w+)" &lt;BR /&gt;
| rex "(?i) %SYS-CFC[1-9]-5-RESTART: (?P\w+\s+\w+)" &lt;BR /&gt;
| eval state=coldboot." ".restart &lt;BR /&gt;
| table host, state, _time&lt;/P&gt;

&lt;P&gt;where did i miss "".. please let me know. thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 10:08:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147772#M41315</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T10:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147773#M41316</link>
      <description>&lt;P&gt;if i display coldboot and restart seperately, im getting results.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 10:30:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147773#M41316</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T10:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147774#M41317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm not sure why it isnot working for you. I have tested this in my environment. Did you try in your eval expression eval state= field1 + field2?  space between field1, + and field2?&lt;/P&gt;

&lt;P&gt;-Krishna Rajapantula&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 10:35:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147774#M41317</guid>
      <dc:creator>krishnarajapant</dc:creator>
      <dc:date>2015-07-30T10:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147775#M41318</link>
      <description>&lt;P&gt;yes krishna... tried the same and used . as well... donno y... still searching....&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 10:57:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147775#M41318</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T10:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147776#M41319</link>
      <description>&lt;P&gt;I see the slash is then probably only missing here because you didn't put everything in a code sample block.&lt;/P&gt;

&lt;P&gt;I did this query to test and then everything is working:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* earliest=-10s@s
| eval colddata="nwfin1swt2 : 2015 Jul 27 23:01:29 CDT: %SATCTRL-FEX101-2-SATCTRL: FEX-101 Module 1: Cold boot" 
| eval restartdata="nwfin2sw1001 26: Jul 27 15:58:36.267: %SYS-CFC7-5-RESTART: System restarted -"
| rex field=colddata "(?i) Module 1: (?&amp;lt;coldboot&amp;gt;\w+\s+\w+)"
| rex field=restartdata "(?i) %SYS-CFC[1-9]-5-RESTART: (?&amp;lt;restart&amp;gt;\w+\s+\w+)"
| eval status=coldboot." ".restart
| table coldboot restart status
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can you test if that is also working in your environment I did this in Splunk 6.2.3&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 11:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147776#M41319</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2015-07-30T11:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147777#M41320</link>
      <description>&lt;P&gt;Hi aholzel,&lt;/P&gt;

&lt;P&gt;its listing all devices, and all results getting filled with same results. please check the below logs for your reference. &lt;/P&gt;

&lt;P&gt;host    coldboot    restart status&lt;BR /&gt;
lb01b   Cold boot   System restarted    Cold boot System restarted&lt;BR /&gt;
lb01b      Cold boot    System restarted    Cold boot System restarted&lt;BR /&gt;
lb01b   Cold boot   System restarted    Cold boot System restarted&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 14:28:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147777#M41320</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-30T14:28:03Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147778#M41321</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; *swt* "cold boot" OR "system restarted" | rex "(?i) Module 1: (?&amp;lt;coldboot&amp;gt;\w+\s+\w+)" | rex "(?i) %SYS-CFC[1-9]-5-RESTART: (?&amp;lt;restart&amp;gt;\w+\s+\w+)" | eval state=coalesce(coldboot,"")+coalesce(restart,"") | table host, state, _time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since both the fields appear in different events, one will have null value when other is not null. The coalesce command will take the first not null value (so null value for coldboot and restart will be replaced by empty string) and the concatenation would work fine.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2015 15:23:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147778#M41321</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-07-30T15:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147779#M41322</link>
      <description>&lt;P&gt;thanks a lot. it worked..... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; awesome...&lt;/P&gt;

&lt;P&gt;thanks again,&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2015 04:58:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147779#M41322</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-07-31T04:58:12Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147780#M41323</link>
      <description>&lt;P&gt;What does &lt;CODE&gt;*swt* "cold boot" OR "system restarted"&lt;/CODE&gt; imply?&lt;/P&gt;

&lt;P&gt;Would this method be possible to use with two fields where the regex is replaced by getting data directly from a value?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Jul 2015 08:45:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147780#M41323</guid>
      <dc:creator>ohlafl</dc:creator>
      <dc:date>2015-07-31T08:45:48Z</dc:date>
    </item>
    <item>
      <title>Re: help in eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147781#M41324</link>
      <description>&lt;P&gt;yes.. this will give the raw results which contains the words cold boot and system restarted.. like below&lt;/P&gt;

&lt;P&gt;nwfin1swt2 : 2015 Jul 27 23:01:29 CDT: %SATCTRL-FEX101-2-SATCTRL: FEX-101 Module 1: Cold boot&lt;BR /&gt;
 nwfin2sw1001 26: Jul 27 15:58:36.267: %SYS-CFC7-5-RESTART: System restarted -&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 09:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-in-eval/m-p/147781#M41324</guid>
      <dc:creator>marees123</dc:creator>
      <dc:date>2015-08-03T09:32:28Z</dc:date>
    </item>
  </channel>
</rss>

