Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ the address, that rule opens instead. Rules are listed, ordered, turned off and
A rule has three parts.

**Which messages**
- **Addresses**: an IP, a CIDR (`10.0.7.0/24`) or a pattern, comma-separated.
- **Addresses**: comma-separated, each matched whole: an address (`10.0.7.12`), a CIDR range
(`10.0.7.0/24`) or a pattern (`10.0.7.*`). An address is that device only; a rule naming
`10.0.7.1` does not read `10.0.7.12`.
- **Hostnames** and **Applications**: patterns such as `fw-*`, matched against the message as
read without the rule.
- **Raw text contains**: a regular expression, case-insensitive. Behind a relay every device
Expand Down Expand Up @@ -232,13 +234,24 @@ Select one or more facilities to filter by the source subsystem. Common faciliti

### Hostname, App Name and Source IP Filters

Enter part of a hostname, an application name or an IP address. Messages whose field contains the
entered text are displayed:
Enter part of a hostname or an application name. Messages whose field contains the entered text are
displayed:

- Case does not matter, and neither does an accent on a Latin letter: `cafe` finds `CAFÉ-01`.
- Everything else counts as typed, spaces included. `web_01` finds `web_01` and not `web-01`, and
`50%` is a percent sign, not a wildcard.

The **Source IP** box takes an address the way a network is described:

| Typed | Shows the messages from |
|---|---|
| `10.10.1.1` | that address only — not `10.10.1.10` or `10.10.1.100` |
| `10.10.1.0/24` | the CIDR range, here `10.10.1.0` to `10.10.1.255` |
| `10.10.1.*` | the addresses matching the pattern: `*` stands for any characters, `?` for one |
| `10.10.1.` | the addresses containing the text, while it is being typed |

An IPv6 address matches however it is written: `fe80:0::1` finds `fe80::1`.

### Search

The search box looks in each message's text and in its raw line. The button beside it switches
Expand Down
6 changes: 3 additions & 3 deletions frontend/screenshots/bridge/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import './runtime.js';
import { isDemo, override, delayed } from './scene.js';
import { words, filterMatcher, sortMessages, groupMessages } from '../../src/lib/search';
import { words, filterMatcher, sortMessages, groupMessages, addressMatcher } from '../../src/lib/search';
import {
MESSAGES, STATS, SERVER_CONFIG, SERVER_STATUS,
ALERT_RULES, ALERT_HISTORY,
Expand Down Expand Up @@ -103,8 +103,8 @@ let sourceRules = clone(SOURCE_RULES);
* applies. Reading a format is the engine's; the demo does not pretend to.
*/
function trySource(rule, samples) {
const named = (rule.match.sources || []).map((s) => s.trim()).filter(Boolean);
const matches = (ip) => named.some((s) => s === ip || (s.endsWith('.0/24') && ip.startsWith(s.slice(0, -4))));
const named = (rule.match.sources || []).filter((s) => s.trim()).map((s) => addressMatcher(s, false));
const matches = (ip) => named.some((take) => take(ip));
return samples.map((s) => {
const before = messages.find((m) => m.rawMessage === s.raw)
|| { ...messages[0], rawMessage: s.raw, message: s.raw, sourceIP: s.sourceIP };
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/FilterBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
</div>

<input type="text" placeholder={$_('filter.sourceIP')} bind:value={sourceIPText}
on:input={setSourceIP} class="filter-input" />
title={$_('filter.sourceIPHint')} on:input={setSourceIP} class="filter-input" />

<input type="text" placeholder={$_('filter.hostname')} bind:value={hostnameText}
on:input={setHostname} class="filter-input" />
Expand Down
11 changes: 9 additions & 2 deletions frontend/src/components/SourceRuleEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
* preview is here to prevent.
*/
import { onDestroy, onMount } from 'svelte';
import { get } from 'svelte/store';
import { _ } from 'svelte-i18n';
import { messages } from '../lib/stores';
import { SEVERITY_COLORS } from '../lib/constants';
import { activeZone, formatInZone } from '../lib/timezone';
import { toastError, toastSuccess } from '../lib/toast';
import FormatFields from './FormatFields.svelte';
import {
deleteSourceRule, listText, parseList, ruleDraft, rulesVersion, saveSourceRule, trySourceRule,
deleteSourceRule, listText, parseList, ruleDraft, rulesVersion, samplesForRule, saveSourceRule, trySourceRule,
} from '../lib/sources';
import type { SourceRule, SourceSample, SourceTrial } from '../lib/sources';

Expand All @@ -28,6 +30,9 @@
rule.levelFrom = rule.levelFrom || '';
rule.encoding = rule.encoding || '';
let sourcesText = listText(rule.match.sources);
// The samples it opened with, until the addresses change: then the
// latest messages from the addresses as now written.
const openedWith = sourcesText;
let hostnamesText = listText(rule.match.hostnames);
let appNamesText = listText(rule.match.appNames);
let hostMode: 'sent' | 'source' | 'fixed' =
Expand Down Expand Up @@ -62,6 +67,7 @@
clearTimeout(debounce);
debounce = setTimeout(async () => {
const mine = ++generation;
if (sourcesText !== openedWith) samples = samplesForRule(get(messages), current());
try {
const got = samples.length ? await trySourceRule(current(), samples) : [];
if (mine !== generation) return;
Expand Down Expand Up @@ -156,8 +162,9 @@
<h5>{$_('sources.which')}</h5>
<label class="row">
<span class="row-label">{$_('sources.sources')}</span>
<input class="mono" placeholder="10.0.0.9, 10.0.1.0/24" bind:value={sourcesText} on:input={retry} />
<input class="mono" placeholder="10.0.0.9, 10.0.1.0/24, 10.0.2.*" bind:value={sourcesText} on:input={retry} />
</label>
<p class="note">{$_('sources.sourcesHint')}</p>
<div class="line">
<label class="row grow">
<span class="row-label">{$_('sources.hostnames')}</span>
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "Schweregrad",
"severityCount": "Schweregrad ({count})",
"sourceIP": "Quell-IP",
"sourceIPHint": "Eine Adresse (10.0.0.5), ein CIDR-Bereich (10.0.0.0/24), ein Muster (10.0.0.*) oder ein Teil einer Adresse",
"hostname": "Hostname",
"appName": "Anwendungsname",
"searchMessages": "Nachrichten durchsuchen...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "Name",
"which": "Welche Meldungen",
"sources": "Adressen",
"sourcesHint": "Jede Adresse wird vollständig verglichen: eine Adresse (10.0.0.9), ein CIDR-Bereich (10.0.1.0/24) oder ein Muster, in dem * für beliebige Zeichen und ? für ein Zeichen steht (10.0.2.*).",
"hostnames": "Hostnamen",
"appNames": "Anwendungen",
"pattern": "Rohtext enthält",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "Severity",
"severityCount": "Severity ({count})",
"sourceIP": "Source IP",
"sourceIPHint": "An address (10.0.0.5), a CIDR range (10.0.0.0/24), a pattern (10.0.0.*), or part of an address",
"hostname": "Hostname",
"appName": "App Name",
"searchMessages": "Search messages...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "Name",
"which": "Which messages",
"sources": "Addresses",
"sourcesHint": "Each address is matched whole: one address (10.0.0.9), a CIDR range (10.0.1.0/24), or a pattern where * stands for any characters and ? for one (10.0.2.*).",
"hostnames": "Hostnames",
"appNames": "Applications",
"pattern": "Raw text contains",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "Severidad",
"severityCount": "Severidad ({count})",
"sourceIP": "IP de origen",
"sourceIPHint": "Una dirección (10.0.0.5), un rango CIDR (10.0.0.0/24), un patrón (10.0.0.*) o parte de una dirección",
"hostname": "Hostname",
"appName": "Nombre de aplicación",
"searchMessages": "Buscar mensajes...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "Nombre",
"which": "Qué mensajes",
"sources": "Direcciones",
"sourcesHint": "Cada dirección se compara entera: una dirección (10.0.0.9), un rango CIDR (10.0.1.0/24) o un patrón donde * sustituye a cualquier secuencia de caracteres y ? a uno solo (10.0.2.*).",
"hostnames": "Nombres de host",
"appNames": "Aplicaciones",
"pattern": "El texto bruto contiene",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "Sévérité",
"severityCount": "Sévérité ({count})",
"sourceIP": "IP source",
"sourceIPHint": "Une adresse (10.0.0.5), une plage CIDR (10.0.0.0/24), un motif (10.0.0.*) ou une partie d'adresse",
"hostname": "Nom d'hôte",
"appName": "Nom de l'application",
"searchMessages": "Rechercher dans les messages...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "Nom",
"which": "Quels messages",
"sources": "Adresses",
"sourcesHint": "Chaque adresse est comparée en entier : une adresse (10.0.0.9), une plage CIDR (10.0.1.0/24), ou un motif où * remplace n'importe quels caractères et ? un seul (10.0.2.*).",
"hostnames": "Noms d’hôte",
"appNames": "Applications",
"pattern": "Le texte brut contient",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "Gravità",
"severityCount": "Gravità ({count})",
"sourceIP": "IP di origine",
"sourceIPHint": "Un indirizzo (10.0.0.5), un intervallo CIDR (10.0.0.0/24), un modello (10.0.0.*) o parte di un indirizzo",
"hostname": "Hostname",
"appName": "Nome applicazione",
"searchMessages": "Cerca messaggi...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "Nome",
"which": "Quali messaggi",
"sources": "Indirizzi",
"sourcesHint": "Ogni indirizzo viene confrontato per intero: un indirizzo (10.0.0.9), un intervallo CIDR (10.0.1.0/24) o un modello in cui * sostituisce qualsiasi sequenza di caratteri e ? uno solo (10.0.2.*).",
"hostnames": "Nomi host",
"appNames": "Applicazioni",
"pattern": "Il testo grezzo contiene",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "重大度",
"severityCount": "重大度 ({count})",
"sourceIP": "送信元 IP",
"sourceIPHint": "アドレス (10.0.0.5)、CIDR 範囲 (10.0.0.0/24)、パターン (10.0.0.*)、またはアドレスの一部",
"hostname": "ホスト名",
"appName": "アプリケーション名",
"searchMessages": "メッセージを検索...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "名前",
"which": "対象のメッセージ",
"sources": "アドレス",
"sourcesHint": "各アドレスは全体で照合されます: 1 つのアドレス (10.0.0.9)、CIDR 範囲 (10.0.1.0/24)、または * が任意の文字列、? が 1 文字を表すパターン (10.0.2.*)。",
"hostnames": "ホスト名",
"appNames": "アプリケーション",
"pattern": "生テキストに含む",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "Severidade",
"severityCount": "Severidade ({count})",
"sourceIP": "IP de origem",
"sourceIPHint": "Um endereço (10.0.0.5), um intervalo CIDR (10.0.0.0/24), um padrão (10.0.0.*) ou parte de um endereço",
"hostname": "Hostname",
"appName": "Nome da aplicação",
"searchMessages": "Pesquisar mensagens...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "Nome",
"which": "Que mensagens",
"sources": "Endereços",
"sourcesHint": "Cada endereço é comparado por inteiro: um endereço (10.0.0.9), um intervalo CIDR (10.0.1.0/24) ou um padrão em que * substitui quaisquer caracteres e ? um só (10.0.2.*).",
"hostnames": "Nomes de host",
"appNames": "Aplicações",
"pattern": "O texto bruto contém",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/lib/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"severity": "严重程度",
"severityCount": "严重程度 ({count})",
"sourceIP": "源 IP",
"sourceIPHint": "一个地址 (10.0.0.5)、CIDR 范围 (10.0.0.0/24)、模式 (10.0.0.*) 或地址的一部分",
"hostname": "主机名",
"appName": "应用名称",
"searchMessages": "搜索消息...",
Expand Down Expand Up @@ -724,6 +725,7 @@
"name": "名称",
"which": "哪些消息",
"sources": "地址",
"sourcesHint": "每个地址都按整体匹配:单个地址 (10.0.0.9)、CIDR 范围 (10.0.1.0/24),或用 * 代表任意字符、? 代表一个字符的模式 (10.0.2.*)。",
"hostnames": "主机名",
"appNames": "应用",
"pattern": "原始文本包含",
Expand Down
Loading