<?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: Can I REGEX a string and assign to field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432742#M123653</link>
    <description>&lt;P&gt;While testing this configuration it looks like either you need to extract and index this data in another field at Index time or if you want to use search time extraction then you need to apply regex to &lt;CODE&gt;_raw&lt;/CODE&gt; data. &lt;/P&gt;

&lt;P&gt;Based on answers on &lt;A href="https://answers.splunk.com/answers/559858/why-does-a-transforms-report-stanza-have-issues-wi.html"&gt;https://answers.splunk.com/answers/559858/why-does-a-transforms-report-stanza-have-issues-wi.html&lt;/A&gt; &lt;CODE&gt;REPORT&lt;/CODE&gt; has higher precedence then &lt;CODE&gt;KV_MODE&lt;/CODE&gt; and it looks like in your case &lt;CODE&gt;winlogbeat_keywords&lt;/CODE&gt; field extracted by &lt;CODE&gt;KV_MODE=auto&lt;/CODE&gt; so when you define props and transforms for &lt;CODE&gt;winlogbeat_keywords&lt;/CODE&gt; field it will not work because that field was not extracted due to higher precedence of &lt;CODE&gt;REPORT&lt;/CODE&gt; than &lt;CODE&gt;KV_MODE&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;I hope this clears your query.&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 09:28:34 GMT</pubDate>
    <dc:creator>harsmarvania57</dc:creator>
    <dc:date>2018-08-29T09:28:34Z</dc:date>
    <item>
      <title>Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432737#M123648</link>
      <description>&lt;P&gt;I have Graylog forwarding Windows events and I use this command in my props.conf to parser &lt;/P&gt;

&lt;P&gt;FIELDALIAS-winlogbeat_as_action = winlogbeat_keywords  as action&lt;/P&gt;

&lt;P&gt;this sets action to the value of winlogbeat_keywords however it is [audit success] and I want to remove the '[]',&lt;/P&gt;

&lt;P&gt;I know I can use an EXTRACT and a REGEX expression, but I am guessing that is against the entire messages string and I want to run it on winlogbeat_keywords and\or action&lt;/P&gt;

&lt;P&gt;can I do this?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:04:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432737#M123648</guid>
      <dc:creator>pfabrizi</dc:creator>
      <dc:date>2020-09-29T21:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432738#M123649</link>
      <description>&lt;P&gt;Hi @pfabrizi,&lt;/P&gt;

&lt;P&gt;Yes you can apply regex to specific fields. I have created run anywhere search &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval winlogbeat_keywords="[abc xyz]"
| rex field=winlogbeat_keywords "\[(?&amp;lt;action&amp;gt;.*)\]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this helps.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Harshil&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 12:14:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432738#M123649</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-08-28T12:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432739#M123650</link>
      <description>&lt;P&gt;Will this work in a props.conf or transforms.conf?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 12:49:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432739#M123650</guid>
      <dc:creator>pfabrizi</dc:creator>
      <dc:date>2018-08-28T12:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432740#M123651</link>
      <description>&lt;P&gt;Try this on Search Head&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
REPORT-fields = actions_extraction
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[actions_extraction]
SOURCE_KEY = winlogbeat_keywords
REGEX = \[(?&amp;lt;action&amp;gt;.*)\]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Aug 2018 12:57:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432740#M123651</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-08-28T12:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432741#M123652</link>
      <description>&lt;P&gt;I add thi line to my props.conf&lt;/P&gt;

&lt;P&gt;[graylog:windows]&lt;BR /&gt;
REPORT-fields = get-action&lt;/P&gt;

&lt;P&gt;then in transforms.conf &lt;/P&gt;

&lt;P&gt;[get-action]&lt;BR /&gt;
SOURCEKEY_KEY = winlogbeat_keywords&lt;BR /&gt;
REGEX = [(?.*)]&lt;/P&gt;

&lt;P&gt;it doesn't seem to work.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:02:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432741#M123652</guid>
      <dc:creator>pfabrizi</dc:creator>
      <dc:date>2020-09-29T21:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432742#M123653</link>
      <description>&lt;P&gt;While testing this configuration it looks like either you need to extract and index this data in another field at Index time or if you want to use search time extraction then you need to apply regex to &lt;CODE&gt;_raw&lt;/CODE&gt; data. &lt;/P&gt;

&lt;P&gt;Based on answers on &lt;A href="https://answers.splunk.com/answers/559858/why-does-a-transforms-report-stanza-have-issues-wi.html"&gt;https://answers.splunk.com/answers/559858/why-does-a-transforms-report-stanza-have-issues-wi.html&lt;/A&gt; &lt;CODE&gt;REPORT&lt;/CODE&gt; has higher precedence then &lt;CODE&gt;KV_MODE&lt;/CODE&gt; and it looks like in your case &lt;CODE&gt;winlogbeat_keywords&lt;/CODE&gt; field extracted by &lt;CODE&gt;KV_MODE=auto&lt;/CODE&gt; so when you define props and transforms for &lt;CODE&gt;winlogbeat_keywords&lt;/CODE&gt; field it will not work because that field was not extracted due to higher precedence of &lt;CODE&gt;REPORT&lt;/CODE&gt; than &lt;CODE&gt;KV_MODE&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;I hope this clears your query.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 09:28:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432742#M123653</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-08-29T09:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432743#M123654</link>
      <description>&lt;P&gt;So can I do this, which is actually what I want to do.&lt;BR /&gt;
 I need to try and match the auto lookups from the splunk_ta_windows into my custom app.&lt;BR /&gt;
I know we should be using the splunk_ta_windows with the UF, but our operations folks drive what we use for collection,&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;

&lt;P&gt;I need to make [Audit Success] to success or failure...&lt;BR /&gt;
I see in the SPLUNK_TA_WINDOWS they use a lookup.&lt;/P&gt;

&lt;P&gt;LOOKUP-action_for_windows1_security = windows_action_lookup Type OUTPUTNEW action, action AS status&lt;BR /&gt;
LOOKUP-action_for_windows2_security = windows_action_lookup Type as Keywords OUTPUTNEW action, action AS status&lt;/P&gt;

&lt;P&gt;Should I be able to do this in my app? I am trying this:&lt;/P&gt;

&lt;P&gt;Props.conf:&lt;BR /&gt;
LOOKUP-action_for_windows1_security = windows_action_lookup Type OUTPUTNEW action, action AS status&lt;BR /&gt;
LOOKUP-action_for_windows2_security = windows_action_lookup Type as Keywords OUTPUTNEW action, action AS status&lt;/P&gt;

&lt;P&gt;Transforms.conf:&lt;BR /&gt;
[windows_action_lookup]&lt;BR /&gt;
filename = windows_actions_graylog.csv&lt;/P&gt;

&lt;P&gt;windows_actions_graylog.csv:&lt;BR /&gt;
Type,action&lt;BR /&gt;
"audit failure",failure&lt;BR /&gt;
"Audit Failure",failure&lt;BR /&gt;
"AUDIT_FAILURE",failure&lt;BR /&gt;
"failure audit",failure&lt;BR /&gt;
"Failure Audit",failure&lt;BR /&gt;
"FAILURE_AUDIT",failure&lt;BR /&gt;
"audit success",success&lt;BR /&gt;
"[Audit Success]",success&lt;BR /&gt;
"AUDIT_SUCCESS",success&lt;BR /&gt;
"success audit",success&lt;BR /&gt;
"Success Audit",success&lt;BR /&gt;
"SUCCESS_AUDIT",success&lt;BR /&gt;
"success","success"&lt;BR /&gt;
"failure","failure"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:03:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432743#M123654</guid>
      <dc:creator>pfabrizi</dc:creator>
      <dc:date>2020-09-29T21:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432744#M123655</link>
      <description>&lt;P&gt;Also you need to put the regex into the REGEX= field like written above. I See from your config file export that you didn't do that correctly.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;REGEX=\[(?&amp;lt;action&amp;gt;.*)\]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 13:35:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432744#M123655</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-29T13:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432745#M123656</link>
      <description>&lt;P&gt;so this is not correct?&lt;/P&gt;

&lt;P&gt;props.conf.&lt;/P&gt;

&lt;P&gt;REPORT-field = get_action&lt;/P&gt;

&lt;P&gt;Transform:&lt;BR /&gt;
[get_action]&lt;BR /&gt;
SOURCEKEY=winlogbeat_keywords&lt;BR /&gt;
REGEX = [(?.*)]     ------ should this be winlogbeat_keywords?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 21:03:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432745#M123656</guid>
      <dc:creator>pfabrizi</dc:creator>
      <dc:date>2020-09-29T21:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432746#M123657</link>
      <description>&lt;P&gt;If you look what @harsmarvania57 and I wrote then you can see the difference.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 13:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432746#M123657</guid>
      <dc:creator>horsefez</dc:creator>
      <dc:date>2018-08-29T13:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Can I REGEX a string and assign to field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432747#M123658</link>
      <description>&lt;P&gt;sorry, it was a type.&lt;BR /&gt;
I have it as:&lt;BR /&gt;
REGEX = [(?.*)]&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 14:42:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-REGEX-a-string-and-assign-to-field/m-p/432747#M123658</guid>
      <dc:creator>pfabrizi</dc:creator>
      <dc:date>2018-08-29T14:42:32Z</dc:date>
    </item>
  </channel>
</rss>

