log4net.ElasticSearch icon indicating copy to clipboard operation
log4net.ElasticSearch copied to clipboard

AWS Elastic Search Service connection issue with log4Net

Open a08maheshwari opened this issue 4 years ago • 1 comments
trafficstars

I am using Amazon Elasticsearch Service for creating domains using a fine-grained access domain( username and password)

I have configured app.config like this

<configuration>
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    <log4net>
        <appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch">
        <!-- for .NET 40 <appender name="ElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch.Net40">-->
            <connectionString value="Scheme=https;User=xxxx;Pwd=xxxxxx;Server=search-xxxxx-xxxxxxx.region.es.amazonaws.com;Index=log;Port=443;rolling=true"/>
            <lossy value="false" />
            <evaluator type="log4net.Core.LevelEvaluator">
                    <threshold value="ERROR" />
            </evaluator>
            <bufferSize value="100" />
        </appender>
        <root>
            <level value="ALL"/>
            <appender-ref ref="ElasticSearchAppender" />
        </root>
    </log4net>
</configuration>

Calling Method :

private static readonly ILog _log = LogManager.GetLogger(typeof(Program)); _log.Error("errorr", new ApplicationException("The new application exploded")); I tried diagnosing the log4net Logs in to text file, but there is no error in that

Can anyone suggest If there is any possible way to work with Elasticsearch as a service?

Thanks in Advance

a08maheshwari avatar Jul 05 '21 17:07 a08maheshwari

As a starting point:

  1. Create a new account in ElasticSearch, but make sure that the username and password are in plaintext. No special characters in the password. For example, username: name & password: pswd

  2. It might be a permission problem, therefore, give the user a high role (e.g superuser).

Abouzeid avatar Jul 07 '21 07:07 Abouzeid