Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index not showing in ES #85

Open
grillsoftware opened this issue Jan 28, 2022 · 2 comments
Open

Index not showing in ES #85

grillsoftware opened this issue Jan 28, 2022 · 2 comments

Comments

@grillsoftware
Copy link

I'm not sure what am I doing wrong but I don't see the index in my Elasticsearch instance. The console and file appenders work fine. I don't see errors related to the ElasticsearchAppender.

logback.xml

<appender name="ELASTIC" class="com.internetitem.logback.elasticsearch.ElasticsearchAppender">
        <url>http://localhost:9200/_bulk</url>
        <index>dev_myApp-%date{yyyy-MM-dd}</index>
        <type>logback</type>
        <connectTimeout>30000</connectTimeout> <!-- optional (in ms, default 30000) -->
        <errorsToStderr>false</errorsToStderr> <!-- optional (default false) -->
        <includeCallerData>false</includeCallerData> <!-- optional (default false) -->
        <logsToStderr>false</logsToStderr> <!-- optional (default false) -->
        <maxQueueSize>104857600</maxQueueSize> <!-- optional (default 104857600) -->
        <maxRetries>3</maxRetries> <!-- optional (default 3) -->
        <readTimeout>30000</readTimeout> <!-- optional (in ms, default 30000) -->
        <sleepTime>250</sleepTime> <!-- optional (in ms, default 250) -->
        <rawJsonMessage>false</rawJsonMessage> <!-- optional (default false) -->
        <includeMdc>false</includeMdc> <!-- optional (default false) -->
        <maxMessageSize>-1</maxMessageSize> <!-- optional (default -1 -->
        <properties>
            <property>
                <name>severity</name>
                <value>%level</value>
            </property>
            <property>
                <name>thread</name>
                <value>%thread</value>
            </property>
            <property>
                <name>stacktrace</name>
                <value>%ex</value>
            </property>
            <property>
                <name>logger</name>
                <value>%logger{16}.%method</value>
            </property>
            <property>
                <name>server-time</name>
                <value>%date{ISO8601, {{ansible_timezone}}}</value>
            </property>
        </properties>
        <headers>
            <header>
                <name>Content-Type</name>
                <value>text/plain</value>
            </header>
        </headers>
    </appender>
    
    <root level="INFO">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="FILE" />
        <appender-ref ref="ELASTIC" />
    </root>

    <logger name="com.myCompany.myApp" level="DEBUG" />

curl localhost:9200/_cat/indices

green open .geoip_databases                y1revQR7SyWHJIxnAq0z7w 1 0  42    0 40.3mb 40.3mb
green open .kibana_7.16.3_001              zjnnLKjXT362iQdFnXPsHQ 1 0 279   27  2.4mb  2.4mb
green open .apm-custom-link                t8-PvRWaTpSd1n2xuT8tYA 1 0   0    0   226b   226b
green open .apm-agent-configuration        hx8SsYzkTDqkEPpA7aZcvg 1 0   0    0   226b   226b
green open .kibana_task_manager_7.16.3_001 H-Kjao4hRLW45PmEMTvnGw 1 0  17 5352    1mb    1mb
green open .tasks                          Xp2ezFegRo-jzjK4UfUTpQ 1 0   6    0 28.9kb 28.9kb
@jonahbenton
Copy link

That means your logs are not properly getting to, or being captured by, the elastic instance. Try setting errorsToStderr to true, which should report some errors the appender can see to the console, and separately logsToStderr to true can show you the json getting sent to elastic.

At first glance your config looks ok, though we send a header of Content-Type application/json, and you may need to include the authentication tag, depending on your elastic setup.

@agido-jrieks
Copy link

agido-jrieks commented Aug 22, 2022

I had the same problem, it is caused by incorrect error handling here:

The HTTP status code is 200, so the code assumes everything is fine - but the body tells that there was a problem:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants