<?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: Setting field based on eventtype in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362932#M3063</link>
    <description>&lt;P&gt;I believe I may be misunderstanding what you are trying to do. Can you send an example of what your fields should be if the eventtype=xyz?&lt;/P&gt;</description>
    <pubDate>Sun, 01 Oct 2017 14:04:52 GMT</pubDate>
    <dc:creator>andre_tucker</dc:creator>
    <dc:date>2017-10-01T14:04:52Z</dc:date>
    <item>
      <title>Setting field based on eventtype</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362929#M3060</link>
      <description>&lt;P&gt;I do use &lt;STRONG&gt;eventtypes.conf&lt;/STRONG&gt; to extract fields.&lt;BR /&gt;
Then in &lt;STRONG&gt;tags.conf&lt;/STRONG&gt; I do set &lt;STRONG&gt;warning=enable&lt;/STRONG&gt; for some of the fields.&lt;BR /&gt;
Some is &lt;STRONG&gt;error&lt;/STRONG&gt; and other is &lt;STRONG&gt;information&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;In my search, this then shows up as &lt;STRONG&gt;eventtype=xyz&lt;/STRONG&gt;, &lt;STRONG&gt;tags=error&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;I would like to change this so I get a new field called &lt;STRONG&gt;severity&lt;/STRONG&gt;.&lt;BR /&gt;
How do I set the &lt;STRONG&gt;severity&lt;/STRONG&gt; field based on &lt;STRONG&gt;eventtype&lt;/STRONG&gt;?&lt;/P&gt;

&lt;P&gt;Instead of &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tag=information
tag=warning
tag=error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;severity=information
severity=warning
severity=error
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This should be generated by the various type of events.&lt;BR /&gt;
Generating the tags is easy done in tags.conf, but that is what I not need, just the field severity based on the different type of events.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2017 20:51:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362929#M3060</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2017-09-30T20:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field based on eventtype</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362930#M3061</link>
      <description>&lt;P&gt;You could use the eval command with an if or case statement.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval severity=case(tag==error, "Medium", tag==Info, "Low", tag==fatal, "High")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Obviously you would need to change the tag= to whatever values of tags you want and the severities to whatever you would like.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 13:15:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362930#M3061</guid>
      <dc:creator>andre_tucker</dc:creator>
      <dc:date>2017-10-01T13:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field based on eventtype</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362931#M3062</link>
      <description>&lt;P&gt;That could do it, but I would like to have it automatically created. It should substitute the tag 100%&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 13:58:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362931#M3062</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2017-10-01T13:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field based on eventtype</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362932#M3063</link>
      <description>&lt;P&gt;I believe I may be misunderstanding what you are trying to do. Can you send an example of what your fields should be if the eventtype=xyz?&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 14:04:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362932#M3063</guid>
      <dc:creator>andre_tucker</dc:creator>
      <dc:date>2017-10-01T14:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field based on eventtype</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362933#M3064</link>
      <description>&lt;P&gt;See updated post.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 15:01:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362933#M3064</guid>
      <dc:creator>lakromani</dc:creator>
      <dc:date>2017-10-01T15:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting field based on eventtype</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362934#M3065</link>
      <description>&lt;P&gt;I believe I understand what you want to do now. Normally you would use an alias in order to create a new field with the same value of another field. (ex. If you alias source_ip=ip then you would be able to search for that field by using either of those field names). The problem is that this won't work very well for tags. If you alias a tag then you are creating a new field called severity and that field will contain the value of ANY tag, not only the tags that you want because there is no way to say apply an alias only if the tag is a certain value. For example your severity field could end up something like severity=authentication if the authentication tag is also given to those events.&lt;/P&gt;

&lt;P&gt;If you only want to change have the severity field created when those tags contain those values then you could use my previous suggestion.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | eval severity=case(tag==error, "error", tag==info, "info", tag==warning, "warning")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that you would have to do this to any search that you want it applied to. There is a slightly better way that you could achieve this, and that is by using an automatic lookup. &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/Knowledge/DefineanautomaticlookupinSplunkWeb"&gt;https://docs.splunk.com/Documentation/SplunkCloud/6.6.1/Knowledge/DefineanautomaticlookupinSplunkWeb&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;This will allow you to have a field called tag in the lookup and you can have tag=error, tag=info, tag=warning, then you could have another column called severity with the same values. After that put tag as your input field and severity as your output field. Then apply the automatic lookup to the sourcetype, host, or source that you want this to be applied to. Then anytime a tag within that sourcetype, host, or source has the value of any value in your lookup, a field called severity will be created with that value.&lt;/P&gt;

&lt;P&gt;Let me know if this helps.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Oct 2017 15:58:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Setting-field-based-on-eventtype/m-p/362934#M3065</guid>
      <dc:creator>andre_tucker</dc:creator>
      <dc:date>2017-10-01T15:58:39Z</dc:date>
    </item>
  </channel>
</rss>

