<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Deep dive into ELK - Medium]]></title>
        <description><![CDATA[Together we will get into advanced alerting, monitoring queries and how to avoid some common pitfalls. - Medium]]></description>
        <link>https://medium.com/deep-dive-into-elk?source=rss----f211ade3c916---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Deep dive into ELK - Medium</title>
            <link>https://medium.com/deep-dive-into-elk?source=rss----f211ade3c916---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 16:56:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/deep-dive-into-elk" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Alerting Gotchas]]></title>
            <link>https://medium.com/deep-dive-into-elk/alerting-gotchas-de9319b059a6?source=rss----f211ade3c916---4</link>
            <guid isPermaLink="false">https://medium.com/p/de9319b059a6</guid>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[opensearch]]></category>
            <category><![CDATA[logging-and-monitoring]]></category>
            <category><![CDATA[alerting]]></category>
            <dc:creator><![CDATA[Franco martin]]></dc:creator>
            <pubDate>Sun, 23 Mar 2025 00:12:34 GMT</pubDate>
            <atom:updated>2025-03-24T00:35:27.044Z</atom:updated>
            <content:encoded><![CDATA[<p>Now, let us take a moment to review some common pitfalls in alerting.</p><p>By now you should know how to create monitors, triggers and use them to notify you when problems arise.</p><h3>Why should I care?</h3><p>Let’s say you are monitoring for a specific word in a set of logfiles, for example “catastrophic”.</p><p>If you havent taken a look at my <a href="https://medium.com/deep-dive-into-elk/monitoring-changes-in-metrics-61fce4f8de07">Monitoring changes in the metrics</a> guide, I suggest you take the time to read it because if your servers stop sending data, your monitor will become useless.</p><p>In this short guide, I will walk you through the steps to set up better monitors that will alert you even when there is not enough data to do so.</p><h3>Take a look into _shards</h3><p>With every query, comes a “_shards” key that gives us some data about how many shards were queried and if there were any failures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/0*EiRxYnYxxSD6E211.png" /><figcaption>Query response</figcaption></figure><p>This information is useful to set up triggers for when no shards were queried and for when shards failed.</p><h4>Total Shards</h4><p>The “_shards.total” field will be really useful to know if there was relevant data present in the indices queried. If the total amount of shards is zero, there might be an issue with our ingest system.</p><p>To setup a trigger for this, create a new trigger within the monitor and setup the Trigger condition to the following:</p><blockquote>ctx.results[0]._shards.total &lt; 1</blockquote><p>If you have a rough estimate of how many shards you expect to query, use that. This is just a baseline.</p><p>This is just one of many approaches; if you have many monitors querying the same indices, you may want to consider creating a separate monitor for your indices and adding the shard condition to the rest of your monitors like so:</p><blockquote>ctx.results[0]._shards.total &lt; 1 &amp;&amp; ctx.results[0].aggregations.2.buckets.new.doc_count &gt; ctx.results[0].aggregations.2.buckets.old.doc_count</blockquote><p>This is to prevent all of your monitors from erroring out and sending useless notifications.</p><h4>Failed Shards</h4><p>Now that we will be notified if there is relevant data in our indices, we need to get notified if there are problems with our query or nodes.</p><p>Sometimes bad documents can make shards fail. For example, a document that includes a base64 encoded file might make that field too big for OpenSearch to work properly, making that shard fail.</p><p>Fortunately, Opensearch will tell us if any shards failed in the “_shards.failed” field.</p><p>To set a trigger for this, create a new trigger within the monitor and set the Trigger condition to the following:</p><blockquote>ctx.results[0]._shards.failed &gt; 0</blockquote><h3>Hits</h3><p>Another very important metric to look at is the number of documents queried. This data is returned in the “hits.total.value” field, and it may be handy to set up an alert for when no documents are queried.</p><p>The trigger condition for this case is the following:</p><blockquote>ctx.results[0].hits.total.value &lt; 1</blockquote><h3>Other useful links</h3><p><a href="https://opensearch.org/docs/latest/observing-your-data/alerting/index/">OpenSearch Alerting</a></p><p><a href="https://medium.com/deep-dive-into-elk/monitoring-changes-in-metrics-61fce4f8de07">Monitoring changes in metrics</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de9319b059a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/deep-dive-into-elk/alerting-gotchas-de9319b059a6">Alerting Gotchas</a> was originally published in <a href="https://medium.com/deep-dive-into-elk">Deep dive into ELK</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Rollup Jobs]]></title>
            <link>https://medium.com/deep-dive-into-elk/using-rollup-jobs-64093f2b303f?source=rss----f211ade3c916---4</link>
            <guid isPermaLink="false">https://medium.com/p/64093f2b303f</guid>
            <category><![CDATA[rollup]]></category>
            <category><![CDATA[historical]]></category>
            <category><![CDATA[storage]]></category>
            <category><![CDATA[opensearch]]></category>
            <dc:creator><![CDATA[Franco martin]]></dc:creator>
            <pubDate>Fri, 21 Mar 2025 18:59:46 GMT</pubDate>
            <atom:updated>2025-03-21T18:59:46.660Z</atom:updated>
            <content:encoded><![CDATA[<p>Rollup jobs in OpenSearch are a powerful way to summarize and store historical data, making it easier to manage and query large datasets. In this article, we’ll explore what rollup jobs are, why you should use them, and how to set them up in OpenSearch.</p><p>You can find reference code with examples and useful in <a href="https://gitlab.com/franco-martin/snippets/-/tree/main/medium/using-rollup-jobs">Gitlab</a>.</p><h3>What are Rollup Jobs?</h3><p>Rollup jobs allow you to pre-aggregate and store data at a reduced granularity. This is especially useful for time-series data where retaining every single data point may not be necessary. By rolling up data, you can save storage space and improve query performance on historical data.</p><h3>Why Use Rollup Jobs?</h3><h4>Benefits</h4><p>- Reduced Storage Costs: By summarizing data, you can significantly reduce the amount of storage required.<br>- Improved Query Performance: Aggregated data is faster to query, making it easier to retrieve insights from large datasets.<br>- Data Retention: Maintain historical data at a summary level without losing important trends and patterns.</p><h4>Use Cases</h4><ul><li>Monitoring and logging systems</li><li>IoT data aggregation</li><li>Financial transaction summaries</li><li>Web analytics</li></ul><h3>Using rollup jobs to identify errors</h3><p>Using rollup jobs in OpenSearch can be extremely beneficial for aggregating error messages from logs into a numerical summary. By setting up a rollup job, administrators can pre-aggregate log data over defined time intervals, such as hourly or daily. This process involves counting the occurrences of specific error types and storing these counts in a rollup index. For example, instead of retaining every single log entry, the rollup job can summarize the data by aggregating error messages into a total count for each interval. This approach not only reduces storage requirements but also significantly improves query performance when analyzing historical error trends. Administrators can easily retrieve and visualize the total number of errors over time, enabling them to quickly identify patterns and potential issues without sifting through massive amounts of raw log data.</p><h3>Caveats of Rollup Jobs</h3><p>While rollup jobs in OpenSearch provide great advantages for managing and querying large datasets, there are several gotchas to be aware of.</p><h4>Loss of Granularity</h4><p>One common issue is the potential loss of granularity; since rollup jobs aggregate data over specific intervals, you may lose the ability to analyze finer details within those intervals.</p><h4>Knowing Your Data</h4><p>Rollup jobs require careful planning of the dimensions and metrics to be rolled up; a poorly designed rollup job can lead to incomplete or misleading data. It’s also important to note that rollup jobs are not retroactive, meaning they only process data that arrives after the job is created.</p><h3>Best Practices for Ingesting and Managing Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VnmqSVKR9uh9rKrCnideEQ.png" /><figcaption>The definition of Hot and Historical data changes based on the use case</figcaption></figure><h4>Use Data Streams for Ingestion</h4><p>Administrators should use a data stream for ingesting new data. A data stream helps manage time-series data by automatically creating new indices as data arrives and by managing the lifecycle of these indices. By using data streams, you can ensure that your ingestion process is efficient and that your data is organized for optimal performance.</p><h4>Separate Indices with a Writing Alias for Historical Data</h4><p>For historical data, it’s a good practice to use separate indices and a writing alias. This allows you to manage and query historical data efficiently without affecting the ingestion of new data. By separating indices and using a writing alias, you can ensure that your queries are faster and that your historical data is easily accessible.</p><h4>Separate Visualizations for Historical and Hot data</h4><p>Data between rollup and non-rollup indices should not be queried simultaneously. When using OpenSearch dashboards, create separate index patterns for the data stream alias and the historical alias to keep reads separate.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64093f2b303f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/deep-dive-into-elk/using-rollup-jobs-64093f2b303f">Using Rollup Jobs</a> was originally published in <a href="https://medium.com/deep-dive-into-elk">Deep dive into ELK</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring changes in metrics]]></title>
            <link>https://medium.com/deep-dive-into-elk/monitoring-changes-in-metrics-61fce4f8de07?source=rss----f211ade3c916---4</link>
            <guid isPermaLink="false">https://medium.com/p/61fce4f8de07</guid>
            <category><![CDATA[elk]]></category>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[open-distro]]></category>
            <category><![CDATA[alerting]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Franco martin]]></dc:creator>
            <pubDate>Sun, 10 Jan 2021 18:45:29 GMT</pubDate>
            <atom:updated>2021-01-14T15:16:19.777Z</atom:updated>
            <content:encoded><![CDATA[<h3>The situation</h3><p>Lets say we have 6 servers that push events to elasticsearch, we need to know if one of them stops publishing events or if a new one is added.</p><h3>The easy way out</h3><p>The first idea that came to my mind when I found myself in this situation was to set up an alarm with a static treshold. This way, if the unique count of hostnames is not 6 I’d get notified.</p><p>The thing is that when we manage dozens of servers in different environments, that number might change quite often.</p><h3>The solution</h3><p>What if we compare the actual metric with the one from an hour ago?</p><h4>Creating a visualization</h4><p>Like we did in the Getting Started guide, we will start with visualizations.</p><p>Create a metric visualization and use unique count of host.hostname as your metric. Then create a filter aggregation and disable KQL to use Lucene syntax.</p><p>Lets say its 8PM, we need to compare how many hosts we had from 6PM to 7PM with the ones between 7PM and 8PM.</p><p>Make sure you select the last 2 hours as the time filter.</p><p>We will create two filters, the first one will filter documents in the last hour. The syntax for this filter is:</p><blockquote>“<a href="http://twitter.com/timestamp">@timestamp</a>: [now-1h TO now]”</blockquote><p>The second one will filter documents from two hours ago to one hour ago. The syntax is:</p><blockquote>“<a href="http://twitter.com/timestamp">@timestamp</a>: [now-2h TO now-1h]”</blockquote><p>Make sure you add labels to the filters, this will make parsing the responses much easier. I will name the first one “new” and the second one “old”</p><h3>Creating the alert</h3><p>Now that we have the visualization, we can copy the query and create an alert. Remember that kibana will hardcode the dates on the time filter, so make sure you change that.</p><p>Once you create the monitor, the response should look similar to the following one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*2_4QxZCJa5ckUUsUTxymTA.png" /><figcaption>Query Response</figcaption></figure><p>The trigger condition should be that our metrics are different. The expression will be the following:</p><blockquote>ctx.results[0].aggregations.2.buckets.new.1.value != ctx.results[0].aggregations.2.buckets.old.1.value</blockquote><h3>Other useful links</h3><p><a href="https://medium.com/getting-started-with-the-elk-stack/hey-somethings-going-on-b9d8930a2836">Getting started with alerting</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61fce4f8de07" width="1" height="1" alt=""><hr><p><a href="https://medium.com/deep-dive-into-elk/monitoring-changes-in-metrics-61fce4f8de07">Monitoring changes in metrics</a> was originally published in <a href="https://medium.com/deep-dive-into-elk">Deep dive into ELK</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>