<?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: Mapping Fields to Meaningful Names in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85005#M21667</link>
    <description>&lt;P&gt;Ahh, I see - you're talking about the names of the fields themselves, not their values? I don't have any better solution than the one you're already going with, sorry...&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2011 20:17:05 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2011-10-03T20:17:05Z</dc:date>
    <item>
      <title>Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85002#M21664</link>
      <description>&lt;P&gt;I have a vendor log file that has numeric codes for the field names (i.e. E-1, E-710, etc).  The vendor also provides a lookup table that translates the codes into meaningful names (i.e. Asset Name, CPU Time, etc).&lt;/P&gt;

&lt;P&gt;I am currently adding the translation via FIELDALIAS in the props.conf, but I'd rather provide the translation via a lookup table for convenience and maintainability.  Also I'd prefer to replace the numeric code with the meaningful name rather than create duplicates.&lt;/P&gt;

&lt;P&gt;Any ideas on how I should proceed?&lt;/P&gt;

&lt;P&gt;Thanks in advance,&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 15:51:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85002#M21664</guid>
      <dc:creator>cgl</dc:creator>
      <dc:date>2011-10-03T15:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85003#M21665</link>
      <description>&lt;P&gt;Seeing as you're provided with a lookup table from the vendor, you should absolutely be using that, especially if it's in CSV format - just put it in the lookups directory, configure the lookup in props.conf / transforms.conf, and you're all set!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 18:33:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85003#M21665</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-10-03T18:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85004#M21666</link>
      <description>&lt;P&gt;The lookup is a CSV, but the lookup only maps the values, not the fields.  For example,&lt;/P&gt;

&lt;P&gt;E-1=100, could use the lookup table to map to E-1=Error Message&lt;/P&gt;

&lt;P&gt;However, I haven't been able to map the E-1 to a better presentation value, expect via the FIELDALIAS option.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 20:06:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85004#M21666</guid>
      <dc:creator>cgl</dc:creator>
      <dc:date>2011-10-03T20:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85005#M21667</link>
      <description>&lt;P&gt;Ahh, I see - you're talking about the names of the fields themselves, not their values? I don't have any better solution than the one you're already going with, sorry...&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 20:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85005#M21667</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2011-10-03T20:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85006#M21668</link>
      <description>&lt;P&gt;It's okay, I appreciate you taking the time to respond.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2011 15:30:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85006#M21668</guid>
      <dc:creator>cgl</dc:creator>
      <dc:date>2011-10-04T15:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85007#M21669</link>
      <description>&lt;P&gt;This should be possible if your key/value pairs are present in the raw data of your events.&lt;/P&gt;

&lt;P&gt;Let's take a hypothetical example, assuming that this is the raw data of one of your events :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;20 Jan 2011 19:34:22 E-1=100 Purgamentum init, exit purgamentum
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let's say that field name "E-1" needs to be translated to "Error message" and field value "100" needs to be translated to "Banjo infestation".&lt;/P&gt;

&lt;P&gt;The first thing we want to do is to extract the "E-1" and "100" as a field &lt;STRONG&gt;each&lt;/STRONG&gt;, not as a key/value pair. Let's do this with a &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex" target="_blank"&gt;rex&lt;/A&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\d2:\d2:\d2 (?&amp;lt;field_name_code&amp;gt;[^\=]*)\=(?&amp;lt;field_value_code&amp;gt;[^\s]*)\s
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So now we have two new fields : &lt;CODE&gt;field_name_code = E-1&lt;/CODE&gt; and &lt;CODE&gt;field_value_code = 100&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;This is where your &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup" target="_blank"&gt;lookup&lt;/A&gt; comes in (let's say it's defined in transforms.conf as "errorlookup"] to output two new fields : "field_name" which will be looked up based on "field_name_code" and "field_value" which will be looked up based on "field_value_code".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup errorlookup field_name_code field_value_code OUTPUT field_name field_value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So we'll now have a new field named "field_name" with a value of "Error message" and another one called "field_value" with a value of "Banjo infestation".&lt;/P&gt;

&lt;P&gt;Now you want to create a new field that concatenates "field_name" and "field_value" with a known delimiter (let's say "=") :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval error_kv=field_name."=".field_value
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We'll now have a new field called "error_kv" with a value of "Error message=Banjo infestation".&lt;/P&gt;

&lt;P&gt;The final step is to use a delimiter-based search-time field extraction scoped to the "error_kv" field in order to create a new field named "field_name" with a value of "field_value". The options of the &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Extract" target="_blank"&gt;kv&lt;/A&gt; command do not allow for this to be done inline, so we'll need to define our field extraction in $SPLUNK_HOME/etc/system/local/transforms.conf (or anywhere else that is adequate to your configuration) :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract_error_kv]
SOURCE_KEY = error_kv
DELIMS = "="
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And now, we can call this custom extraction inline using &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Extract" target="_blank"&gt;kv&lt;/A&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| kv extract_error_kv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In our example, this should result in the creation of the field "Error message" with a value of "Banjo infestation"!&lt;/P&gt;

&lt;P&gt;Part of this is theory, so I'm quite curious to know if it works in your environment. Please let me know!&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:56:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85007#M21669</guid>
      <dc:creator>hexx</dc:creator>
      <dc:date>2020-09-28T09:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Mapping Fields to Meaningful Names</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85008#M21670</link>
      <description>&lt;P&gt;+1 for banjo infestation&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2011 06:34:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Mapping-Fields-to-Meaningful-Names/m-p/85008#M21670</guid>
      <dc:creator>piebob</dc:creator>
      <dc:date>2011-10-05T06:34:57Z</dc:date>
    </item>
  </channel>
</rss>

