<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Loki_duplicates</id>
	<title>Loki duplicates - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://tech.uvoo.io/index.php?action=history&amp;feed=atom&amp;title=Loki_duplicates"/>
	<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Loki_duplicates&amp;action=history"/>
	<updated>2026-05-10T18:42:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.2</generator>
	<entry>
		<id>https://tech.uvoo.io/index.php?title=Loki_duplicates&amp;diff=5570&amp;oldid=prev</id>
		<title>Busk: Created page with &quot;In Loki, deduplication happens both at ingest-time and (optionally) at query-time, but it’s driven by the combination of:  1. **Stream identity** (tenant + label set, e.g. `...&quot;</title>
		<link rel="alternate" type="text/html" href="https://tech.uvoo.io/index.php?title=Loki_duplicates&amp;diff=5570&amp;oldid=prev"/>
		<updated>2025-07-05T16:29:22Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;In Loki, deduplication happens both at ingest-time and (optionally) at query-time, but it’s driven by the combination of:  1. **Stream identity** (tenant + label set, e.g. `...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In Loki, deduplication happens both at ingest-time and (optionally) at query-time, but it’s driven by the combination of:&lt;br /&gt;
&lt;br /&gt;
1. **Stream identity** (tenant + label set, e.g. `{job=&amp;quot;myjob&amp;quot;}`),&lt;br /&gt;
2. **Timestamp** (the epoch you push), and&lt;br /&gt;
3. **Log line content**&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
**1. Ingest-time dropping of exact duplicates**&lt;br /&gt;
When you push two *identical* log lines (same timestamp, same labels, same exact text) into the *same* stream, the second one is silently dropped. Loki’s distributor dedupes logs that would collide on “timestamp + stream”; only the first one survives ([community.grafana.com][1], [community.grafana.com][2]).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
**2. `increment_duplicate_timestamp` for near-duplicates**&lt;br /&gt;
If you enable in your `loki.yaml` under `limits_config`:&lt;br /&gt;
&lt;br /&gt;
```yaml&lt;br /&gt;
limits_config:&lt;br /&gt;
  increment_duplicate_timestamp: true&lt;br /&gt;
```&lt;br /&gt;
&lt;br /&gt;
then on ingest, whenever a new line arrives with the *same timestamp* **but different content**, Loki will nudge the timestamp forward by one nanosecond to preserve order. This only applies when the log *text differs*—truly identical lines still collide and get deduped as above ([community.grafana.com][1], [community.grafana.com][1]).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
**3. Query-time deduplication in HA setups**&lt;br /&gt;
In a multi-replica deployment (i.e. you’ve set a replication factor &amp;gt; 1), each ingester may hold its own copy of a stream. When you run a query, the Querier automatically deduplicates across ingesters so you don’t see each replica’s copy twice ([community.grafana.com][2], [saikiranpikili.medium.com][3]).&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
### So:&lt;br /&gt;
&lt;br /&gt;
* **Two identical messages** (same epoch, same `job` label, same text) → only one stored.&lt;br /&gt;
* **Two messages with same epoch and `job` but *different* text** → both can be stored (and ordering preserved if you’ve enabled `increment_duplicate_timestamp`).&lt;br /&gt;
* **Multiple replicas** → query-time dedupe prevents you from seeing the same event again.&lt;br /&gt;
&lt;br /&gt;
[1]: https://community.grafana.com/t/loki-drops-duplicate-log-entries/144464?utm_source=chatgpt.com &amp;quot;Loki drops duplicate log entries - Grafana Labs Community Forums&amp;quot;&lt;br /&gt;
[2]: https://community.grafana.com/t/does-loki-deduplicates-messages/124945 &amp;quot;Does Loki deduplicates messages? - Grafana Loki - Grafana Labs Community Forums&amp;quot;&lt;br /&gt;
[3]: https://saikiranpikili.medium.com/grafana-loki-all-you-need-to-know-91682e0708ce?utm_source=chatgpt.com &amp;quot;Grafana Loki: all you need to know | by Sai Kiran Pikili - Medium&amp;quot;&lt;/div&gt;</summary>
		<author><name>Busk</name></author>
	</entry>
</feed>