Что означает исходный тег в HttpEventCollectorLogbackAppender? - PullRequest
0 голосов
/ 31 августа 2018

Я использую HttpEventCollectorLogbackAppender для записи журналов моих java-приложений на дополнительный сервер. Я пытался это очень долго и до сих пор не смог получить свои журналы в спленке.

Может кто-нибудь объяснить, на что ссылается тег source в HttpEventLogbackAppender?

Ниже приведен HttpEventLogbackAppender в моем файле logback.xml:

<appender name="splunk-httpeventcollector-appender"
          class="com.splunk.logging.appenders.logback.HttpEventCollectorLogbackAppender">
    <url>${SPLUNK_HOST_URL}</url>
    <host>${CFG_DC}_${APP_ENV}_${CONTAINER_ID}</host>
    <token>${SPLUNK_TOKEN}</token>
    <source></source> // what does this refer to?
     <index>${SPLUNK_INDEX}</index>

    <disableCertificateValidation>true</disableCertificateValidation>
    <layout class="ch.qos.logback.classic.PatternLayout">
        <Pattern>%d{ISO8601} [%thread] loglevel=%-5level %logger{36} - remotehost=%mdc{req.remoteHost} forwardedfor=%mdc{req.xForwardedFor} requestmethod=%mdc{req.method} requesturi=%mdc{req.requestURI}</Pattern>
    </layout>
    <batch_size_count>500</batch_size_count>
    <send_mode>parallel</send_mode>

</appender>

1 Ответ

0 голосов
/ 31 августа 2018

В Splunk Documentaion я обнаружил следующее: Надеюсь, это поможет вам Ссылка - http://docs.splunk.com/Documentation/Splunk/7.1.2/Data/Aboutdefaultfields

source - источником события является имя файла, потока или другого входа, из которого происходит событие. Для данных, отслеживаемых из файлов и каталогов, значением источника является полный путь, например /archive/server1/var/log/messages.0 или / var / log /. Значение источника для сетевых источников данных - это протокол и порт, например UDP: 514.

 This topic focuses on three key default fields:

        host
        source
        sourcetype

    Defining host, source, and sourcetype

    The host, source, and sourcetype fields are defined as follows:

        host - An event host value is typically the hostname, IP address, or fully qualified domain name of the network host from which the event originated. The host value lets you locate data originating from a specific device. For more information on hosts, see About hosts.
        sourcetype - The source type of an event is the format of the data input from which it originates, such as access_combined or cisco_syslog. The source type determines how your data is to be formatted. For more information on source types, see Why source types matter.

    Source vs sourcetype

    Source and source type are both default fields, but they are entirely different otherwise, and can be easily confused.

        The source is the name of the file, stream, or other input from which a particular event originates. 

        The sourcetype determines how Splunk software processes the incoming data stream into individual events according to the nature of the data.

    Events with the same source type can come from different sources, for example, if you monitor source=/var/log/messages and receive direct syslog input from udp:514. If you search sourcetype=linux_syslog, events from both of those sources are returned. 

Git Hub -

Logback configuration looks like: 

```xml 
<!-- Splunk HTTP Appender --> 
<appender name="splunkHttpAppender" class="com.splunk.logging.HttpEventCollectorLogbackAppender"> 
<url>${lsplunk.http.url}</url> 
<token>${splunk.http.token}</token> 
<source>${splunk.source}</source> 
<host>${splunk.httpevent.listener.host}</host> 
<messageFormat>${splunk.event.message.format}</messageFormat> 
<disableCertificateValidation>${splunk.cert.disable-validation}</disableCertificateValidation> 
<layout class="ch.qos.logback.classic.PatternLayout"> 
<pattern>%date{ISO8601} [%thread] %level: %msg%n</pattern> 
</layout> 
</appender> 

<logger name="com.example.app" additivity="false" level="INFO"> 
<appender-ref ref="splunkHttpAppender"/> 
</logger> 

<root level="INFO"> 
<appender-ref ref="splunkHttpAppender"/> 
</root>
...