Log Parser Pattern Builder (Grok)
Turn parts of an example log line into named fields by tapping them, test the parser on all sample lines, and copy it for your log pipeline.
Funziona nel tuo browser. I tuoi file non lasciano mai il dispositivo. Scopri come verificarlo
…
Come si usa
- 1Paste sample lines
Put several real log lines in Example log lines; the first line is the one you tap.
- 2Detect fields
Press Auto-detect fields, or tap values one by one in the token strip.
- 3Name each field
For the selected value set the field name, pattern and type, then press Save field.
- 4Handle multi-word values
Tap the first part, press Select a range, tap the last part, or use Rest of the line.
- 5Test
Read the Test on all lines table and broaden patterns for lines with a red cross.
- 6Copy the parser
Choose Grok, Logstash, Elasticsearch ingest, Fluent Bit, Vector, Loki, Regex or Python and copy it.
Informazioni su questo strumento
Structured fields make logs searchable: you can count errors per service, chart response times and alert on status codes. Getting there means writing a parser, usually a Grok pattern or a regular expression, and that is where many people get stuck. This builder starts from an example line instead. It splits the line into tokens and recognises timestamps, IP addresses, log levels, UUIDs, paths, quoted strings and numbers. Tap a value to make it a named field with a suggested pattern and type; everything you do not tap must match literally. The parser is tested on every sample line at once, and the result is written as Grok, a Logstash filter, an Elasticsearch ingest pipeline, a Fluent Bit parser, a Vector transform, a Loki pattern and plain regex.
Who this is for
Developers adding logging to a new service, SREs onboarding a legacy application into Elasticsearch, OpenSearch or Loki, and anyone who has stared at a 200-character regular expression wondering which bracket is wrong.
From example to parser
Paste a few real lines, ideally including unusual ones. Auto-detect fields marks every recognised value at once; or tap values one by one. For a value with spaces, such as a thread name or a message, tap the first part, press Select a range and tap the last part. Rest of the line captures everything to the end as GREEDYDATA, the usual way to keep the free-text message.
Patterns and types
Each field uses a Grok pattern such as TIMESTAMP_ISO8601, IP, LOGLEVEL, INT, NUMBER, WORD, NOTSPACE, URIPATHPARAM or QUOTEDSTRING, or QUOTED_CONTENT to capture text inside quotes without the quote marks. Integer and number types add :int and :float so values are stored as numbers. Your own patterns, one per line as NAME regex, can be used like the built-in ones.
Testing
Every sample line is matched with the full pattern and the extracted fields are shown in a table. A red cross means the line does not match, which usually means one value needs a more general pattern, for example NOTSPACE instead of WORD. Matched fields export as CSV.
Outputs
Grok, Logstash filter with a date filter for the timestamp, Elasticsearch ingest pipeline JSON, Fluent Bit regex parser, Vector remap with parse_grok, Loki LogQL pattern expression, JavaScript regex and a Python script.
Worked example
From the line `2026-11-02T10:15:32Z WARN user=42 took 153 ms`, tapping the time, level and both numbers gives `%{TIMESTAMP_ISO8601:ts}\s+%{LOGLEVEL:level}\s+user=%{INT:user:int}\s+took\s+%{INT:ms:int}\s+ms`, which extracts ts, level, user 42 and ms 153 as numbers. The Loki version is `<ts> <level> user=<user> took <ms> ms`.
Limits
The built-in pattern library is a JavaScript-compatible subset of the Logstash core patterns; a few complex definitions are simplified. Multi-line entries such as stack traces need a multiline setting in your shipper first. Loki and regex outputs come from the click builder, so Grok typed by hand is not converted to them.
Esempio svolto
2026-11-02T10:15:32Z WARN user=42 took 153 ms → ts, level, user=42 (int), ms=153 (int); Loki: <ts> <level> user=<user> took <ms> ms.
In breve
- Categoria: Sviluppo e dati
- Funziona nel browser, senza registrazione né caricamento.
- Le informazioni che inserisci restano sul tuo dispositivo.
- Disponibile in inglese.
- Contenuto rivisto l'ultima volta il:
- Fonte ufficiale: Elastic Grok processor and the logstash-patterns-core pattern library (Apache-2.0)
Domande frequenti
What is Grok?
Grok is a pattern language used by Logstash and Elasticsearch. It names reusable regular expressions, so %{IP:client} means "match an IP address and store it as client".
Do I need to know regular expressions?
No. You tap values in the example line and the tool chooses the patterns. The regex is generated for you if you need it.
Why does one of my lines not match?
A value in that line has a form the chosen pattern does not accept, such as a hyphen in a WORD field. Choose a broader pattern like NOTSPACE or DATA for that field.
Can I start from an existing Grok pattern?
Yes. Open Edit Grok directly, paste your pattern and the samples are tested against it. The presets load common formats such as Apache access logs and syslog.
Which output should I use for Loki?
Use the Loki pattern output. It uses LogQL's pattern parser, which is faster than regex for logs with a fixed layout.
Are my logs uploaded?
No. Sample lines are processed in the browser and saved only in local storage.
