<?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: Custom Log in Splunk in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-Log-in-Splunk/m-p/53732#M43882</link>
    <description>&lt;P&gt;You will have to make a dive into the world of index-time transforms.&lt;/P&gt;

&lt;P&gt;Firstly, you have set the sourcetype to 'syslog', which it clearly isn't. This has implications, because Splunk will try to extract host information from each event. This will fail, since the events are not properly syslog-formatted. Change the sourcetype to 'my_ping_log' or something unique. Also, if possible, let the script add a date/timestamp to each event as well.  &lt;/P&gt;

&lt;P&gt;You should look at the following docs for rewriting the host value prior to indexing the events. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.1/Data/Overridedefaulthostassignments" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.1/Data/Overridedefaulthostassignments&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I guess that your files should look something like;&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_ping_log]
TRANSFORMS-set_host = ping_script_host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ping_script_host]
REGEX = ^(\S+)\s+.*
DEST_KEY = MetaData:Host
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please note that the REGEX works for the current event format, i.e. without a timestamp.&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 12:54:31 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2020-09-28T12:54:31Z</dc:date>
    <item>
      <title>Custom Log in Splunk</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-Log-in-Splunk/m-p/53731#M43881</link>
      <description>&lt;P&gt;Hy,&lt;/P&gt;

&lt;P&gt;i write a batch script that pings IP-Adresses.&lt;BR /&gt;
The Results are in a .log file looks like:&lt;BR /&gt;
Switch1 Online&lt;BR /&gt;
Switch2 Online&lt;/P&gt;

&lt;P&gt;When i add the .log as syslog in Splunk i see this entry:&lt;BR /&gt;
1   »  12/4/12&lt;BR /&gt;
2:07:44.000 PM  &lt;/P&gt;

&lt;P&gt;Switch2 Online&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=Splunkserver   Options|  
sourcetype=syslog   Options|  
source=C:\test.log   Options
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2   »  12/4/12&lt;BR /&gt;
2:07:44.000 PM  &lt;/P&gt;

&lt;P&gt;Switch1 Online&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=Splunkserver   Options|  
sourcetype=syslog   Options|  
source=C:\test.log  Options
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can i change the Entry for "host"? The i see host=Switch1 or Switch2, how must look my log file? And How can i add the Option "Status=Online", "Status=Offline" that i can create a search command like this:&lt;BR /&gt;
source="C:\test.log" host="*"  | stats count count(eval(Type="Online")) as On count(eval(Type="Offline")) as Off by host&lt;/P&gt;

&lt;P&gt;When i try this, i see only a count at "counter" nothing at Off and On.&lt;/P&gt;

&lt;P&gt;Any idea or tips for me?&lt;BR /&gt;
thx&lt;/P&gt;</description>
      <pubDate>Tue, 04 Dec 2012 13:16:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-Log-in-Splunk/m-p/53731#M43881</guid>
      <dc:creator>Rhuen</dc:creator>
      <dc:date>2012-12-04T13:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Log in Splunk</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-Log-in-Splunk/m-p/53732#M43882</link>
      <description>&lt;P&gt;You will have to make a dive into the world of index-time transforms.&lt;/P&gt;

&lt;P&gt;Firstly, you have set the sourcetype to 'syslog', which it clearly isn't. This has implications, because Splunk will try to extract host information from each event. This will fail, since the events are not properly syslog-formatted. Change the sourcetype to 'my_ping_log' or something unique. Also, if possible, let the script add a date/timestamp to each event as well.  &lt;/P&gt;

&lt;P&gt;You should look at the following docs for rewriting the host value prior to indexing the events. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.1/Data/Overridedefaulthostassignments" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.1/Data/Overridedefaulthostassignments&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;I guess that your files should look something like;&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_ping_log]
TRANSFORMS-set_host = ping_script_host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[ping_script_host]
REGEX = ^(\S+)\s+.*
DEST_KEY = MetaData:Host
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please note that the REGEX works for the current event format, i.e. without a timestamp.&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:54:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Custom-Log-in-Splunk/m-p/53732#M43882</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2020-09-28T12:54:31Z</dc:date>
    </item>
  </channel>
</rss>

