<?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: Using Eval field in regular expression in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506871#M33697</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;what i meant was in the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;eval IP=if(("$spec_IP$"=="*"),file_ip,"$spec_IP$")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;the field "IP", i would like to use it in the regular expression of the rex field:&lt;/P&gt;&lt;PRE&gt;| rex "\d{1,2}-\S{3}\s\d{2}:\d{2}:\d{2}.\d{3}\s\S{3}\s\[IP\]\s%NICWIN-4-Security_560_Security[\S\s]+?(?&amp;lt;log_time&amp;gt;(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{2}:\d{2}:\d{2})[\S\s]+?\S*Object\sName:\s(?&amp;lt;object_name&amp;gt;[\S\s]+?)New\sHandle\sID[\S\s]+?Primary\sUser\sName:\s(?&amp;lt;username&amp;gt;[\S\s]+?)\s+"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;By just typing the eval field into the regular expression, it does not work as SPLUNK does not process the "IP" as the field in the eval command rather it just takes it as a word "IP" literally.&lt;/P&gt;&lt;PRE&gt;\[IP\]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This is the output i got:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BIJ.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9417i1026662CB24D4028/image-size/large?v=v2&amp;amp;px=999" role="button" title="BIJ.PNG" alt="BIJ.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;BIJ.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Wed, 01 Jul 2020 13:03:41 GMT</pubDate>
    <dc:creator>codywsj</dc:creator>
    <dc:date>2020-07-01T13:03:41Z</dc:date>
    <item>
      <title>Using Eval field in regular expression</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506840#M33694</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was wondering if we can use the field in eval inside the regular expression in rex?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;my search query&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;| eval&lt;EM&gt;&lt;STRONG&gt; IP&lt;/STRONG&gt;&lt;/EM&gt;=if(("$spec_IP$"=="*"),"(?&amp;lt;file_ip&amp;gt;\d+.\d+.\d+.\d+)","$spec_IP$")&lt;BR /&gt;| rex field=_raw "\d{1,2}-\S{3}\s\d{2}:\d{2}:\d{2}.\d{3}\s\S{3}\s\[&lt;EM&gt;&lt;STRONG&gt;IP&lt;/STRONG&gt;&lt;/EM&gt;\]\s%NICWIN-4-Security_560_Security[\S\s]+?(?&amp;lt;log_time&amp;gt;(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{2}:\d{2}:\d{2})[\S\s]+?\S*Object\sName:\s(?&amp;lt;object_name&amp;gt;[\S\s]+?)New\sHandle\sID[\S\s]+?Primary\sUser\sName:\s(?&amp;lt;username&amp;gt;[\S\s]+?)\s+"&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I am trying to use the eval field IP (bold &amp;amp; italic) in the regular expression in the rex command.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 09:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506840#M33694</guid>
      <dc:creator>codywsj</dc:creator>
      <dc:date>2020-07-01T09:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using Eval field in regular expression</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506845#M33696</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223139"&gt;@codywsj&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;did you tried to divide the eval statement in two rows?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex "(?&amp;lt;file_ip&amp;gt;\d+.\d+.\d+.\d+)"
| eval IP=if(("$spec_IP$"=="*"),file_ip,"$spec_IP$")
| rex "\d{1,2}-\S{3}\s\d{2}:\d{2}:\d{2}.\d{3}\s\S{3}\s\[IP\]\s%NICWIN-4-Security_560_Security[\S\s]+?(?&amp;lt;log_time&amp;gt;(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{2}:\d{2}:\d{2})[\S\s]+?\S*Object\sName:\s(?&amp;lt;object_name&amp;gt;[\S\s]+?)New\sHandle\sID[\S\s]+?Primary\sUser\sName:\s(?&amp;lt;username&amp;gt;[\S\s]+?)\s+"&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2020 10:13:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506845#M33696</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-07-01T10:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using Eval field in regular expression</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506871#M33697</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;what i meant was in the&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;eval IP=if(("$spec_IP$"=="*"),file_ip,"$spec_IP$")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;the field "IP", i would like to use it in the regular expression of the rex field:&lt;/P&gt;&lt;PRE&gt;| rex "\d{1,2}-\S{3}\s\d{2}:\d{2}:\d{2}.\d{3}\s\S{3}\s\[IP\]\s%NICWIN-4-Security_560_Security[\S\s]+?(?&amp;lt;log_time&amp;gt;(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{2}\s\d{2}:\d{2}:\d{2})[\S\s]+?\S*Object\sName:\s(?&amp;lt;object_name&amp;gt;[\S\s]+?)New\sHandle\sID[\S\s]+?Primary\sUser\sName:\s(?&amp;lt;username&amp;gt;[\S\s]+?)\s+"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;By just typing the eval field into the regular expression, it does not work as SPLUNK does not process the "IP" as the field in the eval command rather it just takes it as a word "IP" literally.&lt;/P&gt;&lt;PRE&gt;\[IP\]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This is the output i got:&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="BIJ.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/9417i1026662CB24D4028/image-size/large?v=v2&amp;amp;px=999" role="button" title="BIJ.PNG" alt="BIJ.PNG" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;BIJ.PNG&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Wed, 01 Jul 2020 13:03:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-Eval-field-in-regular-expression/m-p/506871#M33697</guid>
      <dc:creator>codywsj</dc:creator>
      <dc:date>2020-07-01T13:03:41Z</dc:date>
    </item>
  </channel>
</rss>

