{"id":20907,"date":"2020-09-15T12:57:28","date_gmt":"2020-09-15T12:57:28","guid":{"rendered":"https:\/\/merikebi.warrenmyers.com\/?p=20907"},"modified":"2020-09-15T12:57:28","modified_gmt":"2020-09-15T12:57:28","slug":"answer-by-warren-for-what-is-the-recommended-way-to-write-to-splunk-using-log4j","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=20907","title":{"rendered":"Answer by warren for What is the recommended way to write to Splunk using Log4J"},"content":{"rendered":"<p>As @<a href=\"https:\/\/stackoverflow.com\/users\/10829300\/honky-donkey\">Honky Donkey<\/a> <a href=\"https:\/\/stackoverflow.com\/a\/63897449\/4418\">said<\/a>, you <em>can<\/em> setup direct logging to the <a href=\"https:\/\/docs.splunk.com\/Documentation\/Splunk\/8.0.5\/Data\/HECExamples\" rel=\"nofollow noreferrer\">HTTP Event Collector<\/a>.<\/p>\n<p>However, that&#8217;s <em>probably<\/em> not the best idea &#8211; unless you&#8217;re <em>also<\/em> logging to local disk.<\/p>\n<p>Why is it not a good idea? Because if you&#8217;re <em>only<\/em> logging to the HEC, you <em><strong>must<\/strong><\/em> have Splunk up and running and configured to receive data from your app (including any requisite HEC tokens) to see any logs your app may generate.<\/p>\n<p>What happens when Splunk is down? Or not otherwise unavailable?<\/p>\n<p>Will your app queue logs until it&#8217;s available again? How long can it queue? What will happen to logs it <em>can <strong>not<\/strong><\/em> queue?<\/p>\n<p>What happens if management decides to change from <a href=\"https:\/\/splunk.com\" rel=\"nofollow noreferrer\">Splunk<\/a> to <a href=\"https:\/\/elastic.co\/what-is\/elk-stack\" rel=\"nofollow noreferrer\">ELK Stack<\/a> or <a href=\"https:\/\/scalyr.com\" rel=\"nofollow noreferrer\">Scalyr<\/a>?<\/p>\n<p>Always log to local disk.<\/p>\n<p><em><strong>Offer<\/strong><\/em> to log elsehwere\/elsehow &#8211; but don&#8217;t <em><strong>only<\/strong><\/em> &quot;log to Splunk&quot;: you never know what may change down the road.<\/p>\n<p>from User warren &#8211; Stack Overflow https:\/\/stackoverflow.com\/questions\/63887068\/what-is-the-recommended-way-to-write-to-splunk-using-log4j\/63901679#63901679<br \/>\nvia <a href=\"https:\/\/ifttt.com\/?ref=da&#038;site=wordpress\">IFTTT<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As @Honky Donkey said, you can setup direct logging to the HTTP Event Collector. However, that&#8217;s probably not the best idea &#8211; unless you&#8217;re also logging to local disk. Why is it not a good idea? Because if you&#8217;re only logging to the HEC, you must have Splunk up and running and configured to receive &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=20907\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">Answer by warren for What is the recommended way to write to Splunk using Log4J<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[991],"keyring_services":[],"class_list":["post-20907","post","type-post","status-publish","format-standard","hentry","category-blih","tag-stackexchange"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/20907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20907"}],"version-history":[{"count":1,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/20907\/revisions"}],"predecessor-version":[{"id":20908,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/20907\/revisions\/20908"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20907"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=20907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}