<?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: customize log event to splunk hec in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/626350#M107603</link>
    <description>&lt;P&gt;Did you find a solution ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the same need.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jan 2023 02:58:00 GMT</pubDate>
    <dc:creator>redg</dc:creator>
    <dc:date>2023-01-09T02:58:00Z</dc:date>
    <item>
      <title>customize log event to splunk hec</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/567331#M100783</link>
      <description>&lt;P&gt;I were able to send my application log to splunk via HTTP event using the splunk java logging library. But somehow the message doesn't look like what appears on my console. Did this happen because the console appender contains an encoder tag? If yes, is there a way for us to specify that inside of the splunk appender? I want splunk to display event exactly like what on my console.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I manually send an event to the index to create the view of what I want it to look like. This's the body content of my rest call to achieve the result in picture 1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;SPAN&gt;"sourcetype"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"httpevent"&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"index"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"customeindex"&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"host"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"optional-field"&lt;/SPAN&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"event"&lt;/SPAN&gt;&lt;SPAN&gt;:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"2021-09-15&amp;nbsp;17:07:58.483&amp;nbsp;[main]&amp;nbsp;INFO&amp;nbsp;&amp;nbsp;org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener.logMessage&amp;nbsp;- Error&amp;nbsp;starting&amp;nbsp;ApplicationContext.&amp;nbsp;To&amp;nbsp;display&amp;nbsp;the&amp;nbsp;conditions&amp;nbsp;report&amp;nbsp;re-run&amp;nbsp;your&amp;nbsp;application&amp;nbsp;with&amp;nbsp;'debug'&amp;nbsp;enabled.\r\n"&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="what i want it to look like" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16021iCC3111FAA78F9618/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-09-16 174409.png" alt="what i want it to look like" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;what i want it to look like&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But the below is what I got. All the information like logger, severity, threat and time are already included in the message so I don't want my app to send all that to splunk in the event.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="the current data" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/16022i49EF985EBC1E9922/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2021-09-16 175832.png" alt="the current data" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;the current data&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;configuration&amp;gt;
	&amp;lt;include resource="org/springframework/boot/logging/logback/defaults.xml" /&amp;gt;

	&amp;lt;property name="defaultPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger.%M - %msg%n"/&amp;gt;
	&amp;lt;property name="LogFilePath" value="${LogFilePath:-.}"/&amp;gt;
	

	&amp;lt;appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"&amp;gt;
		&amp;lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&amp;gt;
			&amp;lt;pattern&amp;gt;${defaultPattern}&amp;lt;/pattern&amp;gt;
		&amp;lt;/encoder&amp;gt;
	&amp;lt;/appender&amp;gt;
	
	&amp;lt;Appender name="splunkAppender" class="com.splunk.logging.HttpEventCollectorLogbackAppender"&amp;gt;
        &amp;lt;url&amp;gt;https://random:8088&amp;lt;/url&amp;gt;
        &amp;lt;token&amp;gt;132&amp;lt;/token&amp;gt;
        &amp;lt;index&amp;gt;randomindex&amp;lt;/index&amp;gt;
        &amp;lt;disableCertificateValidation&amp;gt;true&amp;lt;/disableCertificateValidation&amp;gt;
        &amp;lt;host&amp;gt;${hostname}&amp;lt;/host&amp;gt;
        &amp;lt;source&amp;gt;orchestrator&amp;lt;/source&amp;gt;
        &amp;lt;sourcetype&amp;gt;json&amp;lt;/sourcetype&amp;gt;
        &amp;lt;layout class="ch.qos.logback.classic.PatternLayout"&amp;gt;
            &amp;lt;pattern&amp;gt;${defaultPattern}&amp;lt;/pattern&amp;gt;
        &amp;lt;/layout&amp;gt;
    &amp;lt;/Appender&amp;gt;
    
    
    &amp;lt;springProfile name="!local"&amp;gt;
    	&amp;lt;root level="info"&amp;gt;
			&amp;lt;appender-ref ref="CONSOLE" /&amp;gt;
			&amp;lt;appender-ref ref="splunkAppender" /&amp;gt;
		&amp;lt;/root&amp;gt;
	&amp;lt;/springProfile&amp;gt;

	 &amp;lt;springProfile name="local"&amp;gt;
    	&amp;lt;root level="info"&amp;gt;
			&amp;lt;appender-ref ref="CONSOLE" /&amp;gt;
			&amp;lt;appender-ref ref="APPLICATION" /&amp;gt;
		&amp;lt;/root&amp;gt;
	&amp;lt;/springProfile&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 23:15:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/567331#M100783</guid>
      <dc:creator>splunkNewbie10</dc:creator>
      <dc:date>2021-09-16T23:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: customize log event to splunk hec</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/626350#M107603</link>
      <description>&lt;P&gt;Did you find a solution ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have the same need.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 02:58:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/626350#M107603</guid>
      <dc:creator>redg</dc:creator>
      <dc:date>2023-01-09T02:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: customize log event to splunk hec</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/678126#M113329</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;layout class="ch.qos.logback.classic.PatternLayout"&amp;gt;
            &amp;lt;pattern&amp;gt;%msg&amp;lt;/pattern&amp;gt;
        &amp;lt;/layout&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in you HEC appender you need to set '%msg' as the pattern, but NOT the one you use for the Console Appender (which is the 'defaultPattern')&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2024 20:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/customize-log-event-to-splunk-hec/m-p/678126#M113329</guid>
      <dc:creator>bodoTe</dc:creator>
      <dc:date>2024-02-20T20:07:51Z</dc:date>
    </item>
  </channel>
</rss>

