Solr to Application Insights












0















How can I configure Solr logs to get sent to Azure Application Insights?



I see can use a Log4J appender.
https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-trace-logs



Solr is an open source project, and I don't compile it myself, I just use the distribution.



How can I drop in Application Insights/Log4J appender, without recompiling having installed the SDK?
I just want to configure the logs to get sent to application insghts, for effectively a 3rd party application.
And configure the instrumentation key.



I'm normally a C# dev, but familiar with Log4Net. So appologies if this is simple in Java Log4J. Not been able to find a post for this scenario so posting here.



Using Solr 6.6.










share|improve this question


















  • 1





    Have you seen Configuring Logging in the Solr reference guide? It's using log4j2, and you can add any .jars in the lib directories defined in your solr configuration file.

    – MatsLindh
    Nov 22 '18 at 22:28











  • Thanks, yes I read that page, but didn't see anything on referencing other jars? I presume possible, but can't see a detailed guide.

    – Ian
    Nov 22 '18 at 22:36






  • 1





    See Lib directives in solrconfig for how to give specific paths to load jars from

    – MatsLindh
    Nov 23 '18 at 7:22











  • thanks, that link was broken but found the page - lucene.apache.org/solr/guide/6_6/…

    – Ian
    Nov 23 '18 at 9:44
















0















How can I configure Solr logs to get sent to Azure Application Insights?



I see can use a Log4J appender.
https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-trace-logs



Solr is an open source project, and I don't compile it myself, I just use the distribution.



How can I drop in Application Insights/Log4J appender, without recompiling having installed the SDK?
I just want to configure the logs to get sent to application insghts, for effectively a 3rd party application.
And configure the instrumentation key.



I'm normally a C# dev, but familiar with Log4Net. So appologies if this is simple in Java Log4J. Not been able to find a post for this scenario so posting here.



Using Solr 6.6.










share|improve this question


















  • 1





    Have you seen Configuring Logging in the Solr reference guide? It's using log4j2, and you can add any .jars in the lib directories defined in your solr configuration file.

    – MatsLindh
    Nov 22 '18 at 22:28











  • Thanks, yes I read that page, but didn't see anything on referencing other jars? I presume possible, but can't see a detailed guide.

    – Ian
    Nov 22 '18 at 22:36






  • 1





    See Lib directives in solrconfig for how to give specific paths to load jars from

    – MatsLindh
    Nov 23 '18 at 7:22











  • thanks, that link was broken but found the page - lucene.apache.org/solr/guide/6_6/…

    – Ian
    Nov 23 '18 at 9:44














0












0








0








How can I configure Solr logs to get sent to Azure Application Insights?



I see can use a Log4J appender.
https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-trace-logs



Solr is an open source project, and I don't compile it myself, I just use the distribution.



How can I drop in Application Insights/Log4J appender, without recompiling having installed the SDK?
I just want to configure the logs to get sent to application insghts, for effectively a 3rd party application.
And configure the instrumentation key.



I'm normally a C# dev, but familiar with Log4Net. So appologies if this is simple in Java Log4J. Not been able to find a post for this scenario so posting here.



Using Solr 6.6.










share|improve this question














How can I configure Solr logs to get sent to Azure Application Insights?



I see can use a Log4J appender.
https://docs.microsoft.com/en-us/azure/application-insights/app-insights-java-trace-logs



Solr is an open source project, and I don't compile it myself, I just use the distribution.



How can I drop in Application Insights/Log4J appender, without recompiling having installed the SDK?
I just want to configure the logs to get sent to application insghts, for effectively a 3rd party application.
And configure the instrumentation key.



I'm normally a C# dev, but familiar with Log4Net. So appologies if this is simple in Java Log4J. Not been able to find a post for this scenario so posting here.



Using Solr 6.6.







solr log4j azure-application-insights






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 22:17









IanIan

961820




961820








  • 1





    Have you seen Configuring Logging in the Solr reference guide? It's using log4j2, and you can add any .jars in the lib directories defined in your solr configuration file.

    – MatsLindh
    Nov 22 '18 at 22:28











  • Thanks, yes I read that page, but didn't see anything on referencing other jars? I presume possible, but can't see a detailed guide.

    – Ian
    Nov 22 '18 at 22:36






  • 1





    See Lib directives in solrconfig for how to give specific paths to load jars from

    – MatsLindh
    Nov 23 '18 at 7:22











  • thanks, that link was broken but found the page - lucene.apache.org/solr/guide/6_6/…

    – Ian
    Nov 23 '18 at 9:44














  • 1





    Have you seen Configuring Logging in the Solr reference guide? It's using log4j2, and you can add any .jars in the lib directories defined in your solr configuration file.

    – MatsLindh
    Nov 22 '18 at 22:28











  • Thanks, yes I read that page, but didn't see anything on referencing other jars? I presume possible, but can't see a detailed guide.

    – Ian
    Nov 22 '18 at 22:36






  • 1





    See Lib directives in solrconfig for how to give specific paths to load jars from

    – MatsLindh
    Nov 23 '18 at 7:22











  • thanks, that link was broken but found the page - lucene.apache.org/solr/guide/6_6/…

    – Ian
    Nov 23 '18 at 9:44








1




1





Have you seen Configuring Logging in the Solr reference guide? It's using log4j2, and you can add any .jars in the lib directories defined in your solr configuration file.

– MatsLindh
Nov 22 '18 at 22:28





Have you seen Configuring Logging in the Solr reference guide? It's using log4j2, and you can add any .jars in the lib directories defined in your solr configuration file.

– MatsLindh
Nov 22 '18 at 22:28













Thanks, yes I read that page, but didn't see anything on referencing other jars? I presume possible, but can't see a detailed guide.

– Ian
Nov 22 '18 at 22:36





Thanks, yes I read that page, but didn't see anything on referencing other jars? I presume possible, but can't see a detailed guide.

– Ian
Nov 22 '18 at 22:36




1




1





See Lib directives in solrconfig for how to give specific paths to load jars from

– MatsLindh
Nov 23 '18 at 7:22





See Lib directives in solrconfig for how to give specific paths to load jars from

– MatsLindh
Nov 23 '18 at 7:22













thanks, that link was broken but found the page - lucene.apache.org/solr/guide/6_6/…

– Ian
Nov 23 '18 at 9:44





thanks, that link was broken but found the page - lucene.apache.org/solr/guide/6_6/…

– Ian
Nov 23 '18 at 9:44












1 Answer
1






active

oldest

votes


















2














It takes a lot less configuration than you'd expect, and most of the info is hidden away in the link that you've already got: https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-trace-logs



First, go download the jar files from https://github.com/Microsoft/ApplicationInsights-Java/releases. You'll want applicationinsights-logging-log4j1_2-2.3.0 and applicationinsights-core-2.3.0. Put these in the server/lib folder and Solr will load them automatically for you.



Next you''ll need to add a new appender for app insights into your log4j.properties file



# Appinsights
log4j.appender.aiAppender=com.microsoft.applicationinsights.log4j.v1_2.ApplicationInsightsAppender
log4j.appender.aiAppender.layout=org.apache.log4j.EnhancedPatternLayout
log4j.appender.aiAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n


You also need to add this aiAppender to the log4j.rootLogger list in the same file (it'll probably look something like this: log4j.rootLogger=INFO, file, CONSOLE, aiAppender)



Finally, you need an ApplicationInsights.xml file, which you can get an example of from here https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-get-started#2-add-the-application-insights-sdk-for-java-to-your-project



Drop this in the server/resources folder, set your instrumentation key and you're good to go!






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438572%2fsolr-to-application-insights%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2














    It takes a lot less configuration than you'd expect, and most of the info is hidden away in the link that you've already got: https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-trace-logs



    First, go download the jar files from https://github.com/Microsoft/ApplicationInsights-Java/releases. You'll want applicationinsights-logging-log4j1_2-2.3.0 and applicationinsights-core-2.3.0. Put these in the server/lib folder and Solr will load them automatically for you.



    Next you''ll need to add a new appender for app insights into your log4j.properties file



    # Appinsights
    log4j.appender.aiAppender=com.microsoft.applicationinsights.log4j.v1_2.ApplicationInsightsAppender
    log4j.appender.aiAppender.layout=org.apache.log4j.EnhancedPatternLayout
    log4j.appender.aiAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n


    You also need to add this aiAppender to the log4j.rootLogger list in the same file (it'll probably look something like this: log4j.rootLogger=INFO, file, CONSOLE, aiAppender)



    Finally, you need an ApplicationInsights.xml file, which you can get an example of from here https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-get-started#2-add-the-application-insights-sdk-for-java-to-your-project



    Drop this in the server/resources folder, set your instrumentation key and you're good to go!






    share|improve this answer




























      2














      It takes a lot less configuration than you'd expect, and most of the info is hidden away in the link that you've already got: https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-trace-logs



      First, go download the jar files from https://github.com/Microsoft/ApplicationInsights-Java/releases. You'll want applicationinsights-logging-log4j1_2-2.3.0 and applicationinsights-core-2.3.0. Put these in the server/lib folder and Solr will load them automatically for you.



      Next you''ll need to add a new appender for app insights into your log4j.properties file



      # Appinsights
      log4j.appender.aiAppender=com.microsoft.applicationinsights.log4j.v1_2.ApplicationInsightsAppender
      log4j.appender.aiAppender.layout=org.apache.log4j.EnhancedPatternLayout
      log4j.appender.aiAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n


      You also need to add this aiAppender to the log4j.rootLogger list in the same file (it'll probably look something like this: log4j.rootLogger=INFO, file, CONSOLE, aiAppender)



      Finally, you need an ApplicationInsights.xml file, which you can get an example of from here https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-get-started#2-add-the-application-insights-sdk-for-java-to-your-project



      Drop this in the server/resources folder, set your instrumentation key and you're good to go!






      share|improve this answer


























        2












        2








        2







        It takes a lot less configuration than you'd expect, and most of the info is hidden away in the link that you've already got: https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-trace-logs



        First, go download the jar files from https://github.com/Microsoft/ApplicationInsights-Java/releases. You'll want applicationinsights-logging-log4j1_2-2.3.0 and applicationinsights-core-2.3.0. Put these in the server/lib folder and Solr will load them automatically for you.



        Next you''ll need to add a new appender for app insights into your log4j.properties file



        # Appinsights
        log4j.appender.aiAppender=com.microsoft.applicationinsights.log4j.v1_2.ApplicationInsightsAppender
        log4j.appender.aiAppender.layout=org.apache.log4j.EnhancedPatternLayout
        log4j.appender.aiAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n


        You also need to add this aiAppender to the log4j.rootLogger list in the same file (it'll probably look something like this: log4j.rootLogger=INFO, file, CONSOLE, aiAppender)



        Finally, you need an ApplicationInsights.xml file, which you can get an example of from here https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-get-started#2-add-the-application-insights-sdk-for-java-to-your-project



        Drop this in the server/resources folder, set your instrumentation key and you're good to go!






        share|improve this answer













        It takes a lot less configuration than you'd expect, and most of the info is hidden away in the link that you've already got: https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-trace-logs



        First, go download the jar files from https://github.com/Microsoft/ApplicationInsights-Java/releases. You'll want applicationinsights-logging-log4j1_2-2.3.0 and applicationinsights-core-2.3.0. Put these in the server/lib folder and Solr will load them automatically for you.



        Next you''ll need to add a new appender for app insights into your log4j.properties file



        # Appinsights
        log4j.appender.aiAppender=com.microsoft.applicationinsights.log4j.v1_2.ApplicationInsightsAppender
        log4j.appender.aiAppender.layout=org.apache.log4j.EnhancedPatternLayout
        log4j.appender.aiAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} %-5p (%t) [%X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n


        You also need to add this aiAppender to the log4j.rootLogger list in the same file (it'll probably look something like this: log4j.rootLogger=INFO, file, CONSOLE, aiAppender)



        Finally, you need an ApplicationInsights.xml file, which you can get an example of from here https://docs.microsoft.com/en-gb/azure/azure-monitor/app/java-get-started#2-add-the-application-insights-sdk-for-java-to-your-project



        Drop this in the server/resources folder, set your instrumentation key and you're good to go!







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 1 at 15:47









        StuartStuart

        362




        362
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53438572%2fsolr-to-application-insights%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]