# Mezmo New Lines Finder (`martin.forejt/mezmo-new-lines-finder`) Actor

Analyzes Mezmo (LogDNA) error logs and detects new, recurring, and resolved error patterns by comparing a selected day against a historical baseline. Supports configurable time windows, minimum occurrence thresholds, and optional Slack notifications.

- **URL**: https://apify.com/martin.forejt/mezmo-new-lines-finder.md
- **Developed by:** [Martin Forejt](https://apify.com/martin.forejt) (community)
- **Categories:** Automation, Developer tools, Other
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Mezmo New Lines Finder

Apify Actor that analyzes Mezmo (LogDNA) error logs and classifies them by comparing a selected day against a historical baseline. It identifies **new**, **recurring**, and **resolved** error patterns, generates an interactive HTML dashboard, and optionally sends a summary to Slack.

### How it works

1. Connects to Mezmo using the provided service key.
2. Queries deduplicated logs for two time ranges:
   - **Selected day** — today (start of UTC day to now), yesterday (full UTC day), or the last 24 hours.
   - **Baseline** — the N days immediately before the selected day (default 7).
3. Normalizes error messages (strips UUIDs, hex hashes, IPs, timestamps, durations, Kubernetes pod names, etc.) and groups them by `app::normalized_message`.
4. Classifies each error group:
   - **New** — appeared on the selected day but not in the baseline period.
   - **Recurring** — appeared in both. Trend is computed from the daily average:
     - *spike* — today's count > 2× daily average
     - *lower* — today's count < 0.5× daily average
     - *normal* — within expected range
   - **Resolved** — appeared in the baseline but not on the selected day.
5. Generates an interactive HTML dashboard and stores it in the key-value store.
6. Outputs structured JSON to the default dataset and key-value store.
7. Optionally posts a summary to a Slack channel (with a link to the dashboard).

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `query` | string | Yes | — | Mezmo search query (e.g. `(level:error OR level:fatal) tag:production app:my-app`) |
| `mezmoServiceKey` | string | Yes | — | Mezmo [service key](https://docs.mezmo.com/docs/ingestion-key#service-keys-sts) for API authentication (starts with `sts_`) |
| `day` | string | No | `today` | Which day to analyze: `today`, `yesterday`, or `last24h` |
| `daysBack` | integer | No | `7` | Number of days before the selected day to use as the comparison baseline (1–30) |
| `minCount` | integer | No | `1` | Minimum number of occurrences for an error to appear in results |
| `debug` | boolean | No | `false` | Save raw MCP responses for debugging |
| `slackToken` | string | No | — | Slack Bot OAuth token for sending notifications |
| `slackChannel` | string | No | — | Slack channel name or ID (requires `slackToken`) |

#### Example input

```json
{
    "query": "(level:error OR level:fatal) tag:production app:my-app",
    "mezmoServiceKey": "sts_xxx",
    "day": "yesterday",
    "daysBack": 14,
    "minCount": 5,
    "slackToken": "xoxb-xxx",
    "slackChannel": "#errors"
}
````

### Output

#### Dataset

The Actor pushes a JSON object to the default dataset with this structure:

```json
{
    "date_display": "Mar 02, 2026",
    "time_range_display": "00:00 – 14:30 UTC vs. Feb 23–Mar 01",
    "day_label": "Today",
    "query": "...",
    "summary": {
        "today_total": 1234,
        "today_unique": 45,
        "lastweek_total": 5678,
        "lastweek_unique": 89,
        "new_count": 10,
        "recurring_count": 25,
        "resolved_count": 54
    },
    "new": [
        {
            "today": 42,
            "app_tag": "api",
            "message": "TypeError: Cannot read property ...",
            "detail": "exception: TypeError",
            "sample": "raw log line"
        }
    ],
    "recurring": [
        {
            "today": 100,
            "lastweek": 200,
            "trend": "spike",
            "app_tag": "api",
            "message": "Connection timeout ...",
            "detail": null,
            "sample": "raw log line"
        }
    ],
    "resolved": [
        {
            "lastweek": 50,
            "app_tag": "worker",
            "message": "Redis connection refused ...",
            "detail": null,
            "sample": "raw log line"
        }
    ]
}
```

#### Key-value store

| Key | Content type | Description |
|-----|-------------|-------------|
| `OUTPUT` | `application/json` | Same JSON object as the dataset |
| `dashboard.html` | `text/html` | Interactive HTML dashboard with dark theme, filterable tables, and spike callouts |

# Actor input Schema

## `query` (type: `string`):

Mezmo search query for error logs (e.g. '(level:error OR level:fatal) tag:production app:my-app')

## `mezmoServiceKey` (type: `string`):

Mezmo service key for API authentication (starts with 'sts\_'). See https://docs.mezmo.com/docs/ingestion-key#service-keys-sts

## `debug` (type: `boolean`):

Save raw MCP responses for debugging

## `slackToken` (type: `string`):

Slack Bot OAuth token for sending notifications

## `slackChannel` (type: `string`):

Slack channel name (e.g. '#my-channel' or 'my-channel') or channel ID (e.g. 'C0123456789'). Requires slackToken to be set.

## `day` (type: `string`):

Which day to analyze: 'today' (current UTC day so far), 'yesterday' (full previous UTC day), or 'last24h' (last 24 hours from now).

## `daysBack` (type: `integer`):

Number of days before the selected day to use as the comparison baseline.

## `minCount` (type: `integer`):

Minimum number of occurrences for an error to be included in the results.

## Actor input object example

```json
{
  "debug": false,
  "day": "today",
  "daysBack": 7,
  "minCount": 1
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `output` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("martin.forejt/mezmo-new-lines-finder").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("martin.forejt/mezmo-new-lines-finder").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call martin.forejt/mezmo-new-lines-finder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=martin.forejt/mezmo-new-lines-finder",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Mezmo New Lines Finder",
        "description": "Analyzes Mezmo (LogDNA) error logs and detects new, recurring, and resolved error patterns by comparing a selected day against a historical baseline. Supports configurable time windows, minimum occurrence thresholds, and optional Slack notifications.",
        "version": "0.0",
        "x-build-id": "tTmOFyBW3a9eO1zHK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/martin.forejt~mezmo-new-lines-finder/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-martin.forejt-mezmo-new-lines-finder",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/martin.forejt~mezmo-new-lines-finder/runs": {
            "post": {
                "operationId": "runs-sync-martin.forejt-mezmo-new-lines-finder",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/martin.forejt~mezmo-new-lines-finder/run-sync": {
            "post": {
                "operationId": "run-sync-martin.forejt-mezmo-new-lines-finder",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "query",
                    "mezmoServiceKey"
                ],
                "properties": {
                    "query": {
                        "title": "Mezmo Query",
                        "type": "string",
                        "description": "Mezmo search query for error logs (e.g. '(level:error OR level:fatal) tag:production app:my-app')"
                    },
                    "mezmoServiceKey": {
                        "title": "Mezmo Service Key",
                        "type": "string",
                        "description": "Mezmo service key for API authentication (starts with 'sts_'). See https://docs.mezmo.com/docs/ingestion-key#service-keys-sts"
                    },
                    "debug": {
                        "title": "Debug Mode",
                        "type": "boolean",
                        "description": "Save raw MCP responses for debugging",
                        "default": false
                    },
                    "slackToken": {
                        "title": "Slack Token",
                        "type": "string",
                        "description": "Slack Bot OAuth token for sending notifications"
                    },
                    "slackChannel": {
                        "title": "Slack Channel",
                        "type": "string",
                        "description": "Slack channel name (e.g. '#my-channel' or 'my-channel') or channel ID (e.g. 'C0123456789'). Requires slackToken to be set."
                    },
                    "day": {
                        "title": "Day to Analyze",
                        "enum": [
                            "today",
                            "yesterday",
                            "last24h"
                        ],
                        "type": "string",
                        "description": "Which day to analyze: 'today' (current UTC day so far), 'yesterday' (full previous UTC day), or 'last24h' (last 24 hours from now).",
                        "default": "today"
                    },
                    "daysBack": {
                        "title": "Days Back",
                        "minimum": 1,
                        "maximum": 30,
                        "type": "integer",
                        "description": "Number of days before the selected day to use as the comparison baseline.",
                        "default": 7
                    },
                    "minCount": {
                        "title": "Minimum Count",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Minimum number of occurrences for an error to be included in the results.",
                        "default": 1
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
