<?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: add a word/string as a field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331566#M160762</link>
    <description>&lt;P&gt;You can create a field extraction (using a regex, or the field extractor mentioned by Adonio above). And  name the field you created, to be SUDO_ORIGIN.&lt;/P&gt;

&lt;P&gt;Assuming that the event always has something like "sudo[somenumber]: sudo_username "&lt;BR /&gt;
example of inline regex : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch_for_sudo_events  | rex "sudo\[\d+\]: (?&amp;lt;SUDO_ORIGIN&amp;gt;\w+) :"
| table _time SUDO_ORIGIN _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Jun 2017 17:10:17 GMT</pubDate>
    <dc:creator>yannK</dc:creator>
    <dc:date>2017-06-09T17:10:17Z</dc:date>
    <item>
      <title>add a word/string as a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331564#M160760</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;i'm a newbie in the world of splunk and i would know how i can add this &lt;STRONG&gt;word&lt;/STRONG&gt; to make it a field&lt;/P&gt;

&lt;P&gt;My log is :&lt;/P&gt;

&lt;P&gt;&amp;lt;85&amp;gt;Jun  9 14:00:58 ccstcasi sudo[10277]: &lt;STRONG&gt;splunker&lt;/STRONG&gt; : TTY=pts/0 ; PWD=/home/splunker ; USER=root ; COMMAND=/sbin/service chronyd status&lt;/P&gt;

&lt;P&gt;USER =root  host =localhost source =tcp:514 sourcetype =tcp-raw &lt;/P&gt;

&lt;P&gt;i want to change my log to a other log where splunker will be SUDO_ORIGIN=splunker because splunker is the user who initiated the sudo command.&lt;/P&gt;

&lt;P&gt;so i want something like that:&lt;/P&gt;

&lt;P&gt;&amp;lt;85&amp;gt;Jun  9 14:00:58 ccstcasi sudo[10277]: &lt;STRONG&gt;SUDO_ORIGIN=splunker&lt;/STRONG&gt; : TTY=pts/0 ; PWD=/home/splunker ; USER=root ; COMMAND=/sbin/service chronyd status&lt;/P&gt;

&lt;P&gt;USER =root  host =localhost source =tcp:514 sourcetype =tcp-raw       SUDO_ORIGIN:splunker or other user&lt;/P&gt;

&lt;P&gt;because i want to visualize a histogram with: count of sudo command / time and i want to filter the sudo command with SUDO_ORIGIN that is all user who execute the sudo command.  &lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;PS: Sorry for my english&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 14:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331564#M160760</guid>
      <dc:creator>amir_thales</dc:creator>
      <dc:date>2017-06-09T14:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: add a word/string as a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331565#M160761</link>
      <description>&lt;P&gt;hello amir,&lt;BR /&gt;
you can use the interface filed extractor:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;BR /&gt;
also, looks like some linux log, i think that the Add-on for linux has this one prebuilt&lt;BR /&gt;
try download and use here:&lt;BR /&gt;
&lt;A href="https://splunkbase.splunk.com/app/833/"&gt;https://splunkbase.splunk.com/app/833/&lt;/A&gt;&lt;BR /&gt;
follow the docs on the app &lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 16:36:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331565#M160761</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-06-09T16:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: add a word/string as a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331566#M160762</link>
      <description>&lt;P&gt;You can create a field extraction (using a regex, or the field extractor mentioned by Adonio above). And  name the field you created, to be SUDO_ORIGIN.&lt;/P&gt;

&lt;P&gt;Assuming that the event always has something like "sudo[somenumber]: sudo_username "&lt;BR /&gt;
example of inline regex : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch_for_sudo_events  | rex "sudo\[\d+\]: (?&amp;lt;SUDO_ORIGIN&amp;gt;\w+) :"
| table _time SUDO_ORIGIN _raw
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2017 17:10:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331566#M160762</guid>
      <dc:creator>yannK</dc:creator>
      <dc:date>2017-06-09T17:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: add a word/string as a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331567#M160763</link>
      <description>&lt;P&gt;Sorry for the response time, being an alternate student I could not answer you. &lt;/P&gt;

&lt;P&gt;Thank you yannK and adonio for your answer, it helped me a lot&lt;/P&gt;

&lt;P&gt;Amir&lt;BR /&gt;
Cordialy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 09:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331567#M160763</guid>
      <dc:creator>amir_thales</dc:creator>
      <dc:date>2017-06-14T09:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: add a word/string as a field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331568#M160764</link>
      <description>&lt;P&gt;Hello yannK and Adonio,&lt;/P&gt;

&lt;P&gt;thanks for your answers which helped me a lot.&lt;/P&gt;

&lt;P&gt;Amir&lt;/P&gt;

&lt;P&gt;Cordialy&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2017 10:36:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/add-a-word-string-as-a-field/m-p/331568#M160764</guid>
      <dc:creator>amir_thales</dc:creator>
      <dc:date>2017-06-14T10:36:35Z</dc:date>
    </item>
  </channel>
</rss>

