<?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 custom column based on host value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651095#M225115</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258842"&gt;@Naji&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the Department field isn't in the events, you have to create a lookup (called e.g. departments.csv) containing at least two columns (department and host for the enricment).&lt;/P&gt;&lt;P&gt;Then you can run a search like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| lookup departments.csv host OUTPUT department
| rename 
   department AS Department
   host AS Hosts
   IP AS "IP Address"
| table Department Hosts "IP Address"&lt;/LI-CODE&gt;&lt;P&gt;I supposed that the "IP Address" field is extracted as "IP", if not change adapt the search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2023 08:35:49 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-07-19T08:35:49Z</dc:date>
    <item>
      <title>Add a custom column based on host value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651094#M225114</link>
      <description>&lt;P&gt;Hi, let me first state that I am very new to Splunk.&lt;/P&gt;&lt;P&gt;How can I do the following please?&lt;/P&gt;&lt;P&gt;I would like to add a column called &lt;STRONG&gt;Department&lt;/STRONG&gt; to my table. The department value is not part of the event data. It is&amp;nbsp; something I would like to assign based on the value of host:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;STRONG&gt;Department&amp;nbsp;&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;STRONG&gt;Hosts&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;STRONG&gt;IP&amp;nbsp;&lt;/STRONG&gt;&lt;STRONG&gt;Address&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;Sales&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;host1&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.5&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;host2&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.15&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;host3&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.25&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;HR&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;host4&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.35&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;host5&lt;/FONT&gt;&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.45&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;host6&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.55&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;IT&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;host7&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.65&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;host8&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.75&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;host9&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT face="courier new,courier"&gt;15.20.10.85&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I also would like to create a &lt;STRONG&gt;Department&lt;/STRONG&gt; dropdown menu that filters hosts based on department (&lt;EM&gt;dashboard&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;Thank you for your time. I appreciate all your help&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 08:25:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651094#M225114</guid>
      <dc:creator>Naji</dc:creator>
      <dc:date>2023-07-19T08:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Add a custom column based on host value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651095#M225115</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258842"&gt;@Naji&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;if the Department field isn't in the events, you have to create a lookup (called e.g. departments.csv) containing at least two columns (department and host for the enricment).&lt;/P&gt;&lt;P&gt;Then you can run a search like the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;your_search&amp;gt;
| lookup departments.csv host OUTPUT department
| rename 
   department AS Department
   host AS Hosts
   IP AS "IP Address"
| table Department Hosts "IP Address"&lt;/LI-CODE&gt;&lt;P&gt;I supposed that the "IP Address" field is extracted as "IP", if not change adapt the search.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 08:35:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651095#M225115</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-19T08:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add a custom column based on host value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651096#M225116</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258842"&gt;@Naji&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;you can add new field using eval condition&lt;BR /&gt;&lt;BR /&gt;| eval Department =case(host IN("host1","host2","host3"),"Sales",host IN("host4","host5","host6"),"HR",host IN("host7","host8","host9"),"IT",1=1,"NoDept")&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 08:38:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651096#M225116</guid>
      <dc:creator>SanjayReddy</dc:creator>
      <dc:date>2023-07-19T08:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add a custom column based on host value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651130#M225136</link>
      <description>&lt;P&gt;This worked perfectly, thank you&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 14:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651130#M225136</guid>
      <dc:creator>Naji</dc:creator>
      <dc:date>2023-07-19T14:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add a custom column based on host value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651132#M225137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/258842"&gt;@Naji&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated by all the contributors &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 15:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-a-custom-column-based-on-host-value/m-p/651132#M225137</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-07-19T15:05:59Z</dc:date>
    </item>
  </channel>
</rss>

