<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raphael Miranda</title>
    <description>The latest articles on DEV Community by Raphael Miranda (@miranda).</description>
    <link>https://dev.to/miranda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F111295%2Fd5260bf1-f231-4ef2-8c4a-9628c67928ee.jpeg</url>
      <title>DEV Community: Raphael Miranda</title>
      <link>https://dev.to/miranda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/miranda"/>
    <language>en</language>
    <item>
      <title>Sending formatted logs to ELK</title>
      <dc:creator>Raphael Miranda</dc:creator>
      <pubDate>Sat, 15 Dec 2018 18:06:05 +0000</pubDate>
      <link>https://dev.to/miranda/sending-formatted-logs-to-elk-2lb0</link>
      <guid>https://dev.to/miranda/sending-formatted-logs-to-elk-2lb0</guid>
      <description>

&lt;p&gt;If you're using ELK and java you're probably using elastic beat to listen to log files in your servers, parsing and sending to your log storage, elasticsearch. However since your app is generating the log, it can format it to the expected Kibana json document and reduce the complexity of your log processing pipeline. &lt;/p&gt;

&lt;p&gt;The &lt;em&gt;LoggingEventAsyncDisruptorAppender&lt;/em&gt; is able to collect logs to the a Ring Buffer and send them asynchronously to a Redis server where it will sit for a few seconds until the logstash workers can ship them to the elasticsearch server. In the example, an app using Spring Boot is tagging the logs with the correspondent &lt;em&gt;spring.profiles.active&lt;/em&gt; environment, prod, dev, etc. You can include other fields exposed and &lt;a href="https://github.com/logstash/logstash-logback-encoder#standard-fields"&gt;detailed in the docs&lt;/a&gt;.  &lt;/p&gt;

&lt;p&gt;Logback logstash encoder: &lt;em&gt;&lt;a href="https://github.com/logstash/logstash-logback-encoder"&gt;https://github.com/logstash/logstash-logback-encoder&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;appender name="REDIS_APPENDER" class="net.logstash.logback.appender.LoggingEventAsyncDisruptorAppender"&amp;gt;
            &amp;lt;ringBufferSize&amp;gt;131072&amp;lt;/ringBufferSize&amp;gt;
            &amp;lt;appender class="de.idealo.logback.appender.RedisBatchAppender"&amp;gt;
                &amp;lt;connectionConfig&amp;gt;
                    &amp;lt;scheme&amp;gt;NODE&amp;lt;/scheme&amp;gt;
                    &amp;lt;host&amp;gt;redis.host&amp;lt;/host&amp;gt;
                    &amp;lt;port&amp;gt;6379&amp;lt;/port&amp;gt;
                    &amp;lt;password&amp;gt;password&amp;lt;/password&amp;gt;
                    &amp;lt;key&amp;gt;your_app_logs&amp;lt;/key&amp;gt;
                &amp;lt;/connectionConfig&amp;gt;
                &amp;lt;maxBatchMessages&amp;gt;1000&amp;lt;/maxBatchMessages&amp;gt;
                &amp;lt;maxBatchSeconds&amp;gt;10&amp;lt;/maxBatchSeconds&amp;gt;
                &amp;lt;encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder"&amp;gt;
                    &amp;lt;providers&amp;gt;
                        &amp;lt;mdc/&amp;gt;
                        &amp;lt;pattern&amp;gt;
                            &amp;lt;pattern&amp;gt;
                                {
                                "timestamp": "%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}",
                                "message": "%message",
                                "logger": "%logger",
                                "thread": "%thread",
                                "level": "%level",
                                "host": "${HOSTNAME}",
                                "env": "${spring.profiles.active}",
                                "app": "front"
                                }
                            &amp;lt;/pattern&amp;gt;
                        &amp;lt;/pattern&amp;gt;
                        &amp;lt;stackTrace&amp;gt;
                            &amp;lt;throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter"&amp;gt;
                                &amp;lt;maxDepthPerThrowable&amp;gt;30&amp;lt;/maxDepthPerThrowable&amp;gt;
                                &amp;lt;maxLength&amp;gt;4096&amp;lt;/maxLength&amp;gt;
                                &amp;lt;shortenedClassNameLength&amp;gt;20&amp;lt;/shortenedClassNameLength&amp;gt;
                                &amp;lt;rootCauseFirst&amp;gt;true&amp;lt;/rootCauseFirst&amp;gt;
                            &amp;lt;/throwableConverter&amp;gt;
                        &amp;lt;/stackTrace&amp;gt;
                    &amp;lt;/providers&amp;gt;
                &amp;lt;/encoder&amp;gt;
            &amp;lt;/appender&amp;gt;
        &amp;lt;/appender&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




</description>
      <category>springboot</category>
      <category>elk</category>
      <category>logback</category>
      <category>kibana</category>
    </item>
    <item>
      <title>Flags to enable jmx</title>
      <dc:creator>Raphael Miranda</dc:creator>
      <pubDate>Fri, 07 Dec 2018 17:18:20 +0000</pubDate>
      <link>https://dev.to/miranda/flags-to-enable-jmx-4oe6</link>
      <guid>https://dev.to/miranda/flags-to-enable-jmx-4oe6</guid>
      <description>&lt;p&gt;JMX is the xray of the Java world, it allows you to see threads and memory snapshots, debug and track unoptimized hotspots in your application. The JDK comes with the excellent tool, Mission Control that allows you to connect to a running JVM and collect insights from it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fabuf0irfzk35zxe8w060.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fabuf0irfzk35zxe8w060.png" alt="Mission Control"&gt;&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;To configure the JVM for this connection, use these arguments, e.g. in your JAVA_OPTS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-Dcom.sun.management.jmxremote 
-Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false 
-Dcom.sun.management.jmxremote.port=7199 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>java</category>
      <category>jmx</category>
      <category>debugging</category>
    </item>
  </channel>
</rss>
