Log files
Read the logs of web servers, of the system and of applications as JSON rows with typed fields: Apache and nginx access and error logs, syslog RFC 3164 and RFC 5424, logfmt, JSON lines, IIS W3C extended logs, and any other format described with a grok pattern as in Logstash. Dates are written in ISO 8601 with their offset, the lines that do not fit are counted and shown, and a user agent string can be turned into browser, operating system, device type and robot name. Typical uses: count the visits and errors of a website, find the robots that crawl it, load a log into a table, follow the response times of an API behind nginx.
log parse <text>
Description
Parse log lines, the format detected from the first 200 lines: {format, lines, parsed, unparsed, skipped (empty lines and W3C directives), truncated, rows, unparsed_lines (the first 20: line, reason, text)}
Parse log lines, the format detected from the first 200 lines: {format, lines, parsed, unparsed, skipped (empty lines and W3C directives), truncated, rows, unparsed_lines (the first 20: line, reason, text)}
Parameters
text: The log lines (a text without a real line break may separate its lines with the two characters \n; such a \n inside a double-quoted value is kept when the quote closes within the next 8 lines) - String - required
text: The log lines (a text without a real line break may separate its lines with the two characters \n; such a \n inside a double-quoted value is kept when the quote closes within the next 8 lines) - String - required
admin
log parse "127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326 \"http://www.example.com/start.html\" \"Mozilla/4.08 [en] (Win98; I ;Nav)\""
mentdb
{"format": "apache_combined", "lines": 1, "parsed": 1, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"client": "127.0.0.1", "ident": null, "user": "frank", "timestamp": "2000-10-10T13:55:36-07:00", "request": "GET /apache_pb.gif HTTP/1.0", "method": "GET", "path": "/apache_pb.gif", "protocol": "HTTP/1.0", "status": 200, "bytes": 2326, "referer": "http://www.example.com/start.html", "user_agent": "Mozilla/4.08 [en] (Win98; I ;Nav)"}], "unparsed_lines": []}
RFC 5424 with structured data (example of the RFC)
admin
log parse "<165>1 2003-10-11T22:14:15.003Z mymachine.example.com evntslog - ID47 [exampleSDID@32473 iut=\"3\" eventSource=\"Application\" eventID=\"1011\"] An application event log entry"
mentdb
{"format": "rfc5424", "lines": 1, "parsed": 1, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"priority": 165, "facility": "local4", "severity": "notice", "version": 1, "timestamp": "2003-10-11T22:14:15.003+00:00", "hostname": "mymachine.example.com", "app_name": "evntslog", "procid": null, "msgid": "ID47", "structured_data": {"exampleSDID@32473": {"iut": "3", "eventSource": "Application", "eventID": "1011"}}, "message": "An application event log entry"}], "unparsed_lines": []}
nginx with the forwarded address and the request times
admin
log parse "203.0.113.9 - - [03/Nov/2026:10:00:00 +0100] \"GET /api/orders?id=42 HTTP/2.0\" 404 153 \"-\" \"curl/8.4.0\" \"198.51.100.1\" rt=0.012 uct=\"0.001\" uht=0.010 urt=\"0.010\""
mentdb
{"format": "nginx", "lines": 1, "parsed": 1, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"client": "203.0.113.9", "ident": null, "user": null, "timestamp": "2026-11-03T10:00:00+01:00", "request": "GET /api/orders?id=42 HTTP/2.0", "method": "GET", "path": "/api/orders?id=42", "protocol": "HTTP/2.0", "status": 404, "bytes": 153, "referer": null, "user_agent": "curl/8.4.0", "forwarded_for": "198.51.100.1", "request_time": 0.012, "upstream_connect_time": 0.001, "upstream_header_time": 0.01, "upstream_response_time": 0.01}], "unparsed_lines": []}
logfmt, a key without value is true
admin
log parse "ts=2026-11-03T10:00:00Z level=info msg=\"order saved\" order=42 took=12ms ts=2026-11-03T10:00:01Z level=error msg=\"payment refused\" order=43 retry"
mentdb
{"format": "logfmt", "lines": 2, "parsed": 2, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"ts": "2026-11-03T10:00:00Z", "level": "info", "msg": "order saved", "order": "42", "took": "12ms"}, {"ts": "2026-11-03T10:00:01Z", "level": "error", "msg": "payment refused", "order": "43", "retry": true}], "unparsed_lines": []}
IIS (W3C extended): the #Fields directive gives the columns
admin
log parse "#Software: Microsoft Internet Information Services 10.0 #Fields: date time s-ip cs-method cs-uri-stem s-port c-ip cs(User-Agent) sc-status time-taken 2026-11-03 10:00:00 10.0.0.1 GET /index.html 443 192.0.2.7 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64) 200 15"
mentdb
{"format": "w3c", "lines": 3, "parsed": 1, "unparsed": 0, "skipped": 2, "truncated": false, "rows": [{"timestamp": "2026-11-03T10:00:00+00:00", "date": "2026-11-03", "time": "10:00:00", "s-ip": "10.0.0.1", "cs-method": "GET", "cs-uri-stem": "/index.html", "s-port": 443, "c-ip": "192.0.2.7", "cs(User-Agent)": "Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)", "sc-status": 200, "time-taken": 15}], "unparsed_lines": []}
Apache 2.4 error log
admin
log parse "[Wed Oct 11 14:32:52.123456 2000] [core:error] [pid 1234:tid 5678] [client 192.0.2.4:41234] AH00124: Request exceeded the limit of 10 internal redirects"
mentdb
{"format": "apache_error", "lines": 1, "parsed": 1, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"timestamp": "2000-10-11T14:32:52.123456+00:00", "module": "core", "level": "error", "pid": 1234, "tid": "5678", "client": "192.0.2.4:41234", "error_code": "AH00124", "message": "Request exceeded the limit of 10 internal redirects"}], "unparsed_lines": []}
nginx error log
admin
log parse "2026/11/03 10:00:00 [error] 1234#1234: *5 open() \"/usr/share/nginx/html/favicon.ico\" failed (2: No such file or directory), client: 192.0.2.1, server: localhost, request: \"GET /favicon.ico HTTP/1.1\", host: \"localhost\""
mentdb
{"format": "nginx_error", "lines": 1, "parsed": 1, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"timestamp": "2026-11-03T10:00:00+00:00", "level": "error", "pid": 1234, "tid": 1234, "connection": 5, "message": "open() \"/usr/share/nginx/html/favicon.ico\" failed (2: No such file or directory)", "client": "192.0.2.1", "server": "localhost", "request": "GET /favicon.ico HTTP/1.1", "upstream": null, "host": "localhost", "referrer": null}], "unparsed_lines": []}
log parse <text> <json_params>
Description
Parse log lines with parameters: format (auto, apache_common, apache_combined, nginx, apache_error, nginx_error, syslog (RFC 5424 or 3164 for each line), rfc3164, rfc5424, logfmt, json, w3c, grok), pattern (a grok pattern or an array of patterns, implies grok), definitions ({NAME: regex} for the patterns), timezone (UTC), year, types ({field: int | float | bool | string | timestamp}: a value that cannot be converted becomes null; int is exact on 64 bits, a larger integer is kept exactly as written, a decimal is cut toward zero), time_field (a field of json, logfmt or grok rows written in ISO 8601, epoch seconds and milliseconds accepted, a value that is not a date is left as it is), fields (the fields to keep, in this order), add_line (true: the number of the line first), useragent (true: ua with the result of log useragent for user_agent, agent or cs(User-Agent)), normalize_time (true), output (full, rows: only the rows, summary: no rows), max_unparsed (20, 10000 at most), max_lines (1000000), offset (0), line_max (1048576), line_timeout_ms (200), timeout_ms (60000: the whole reading, also inside a very long line)
Parse log lines with parameters: format (auto, apache_common, apache_combined, nginx, apache_error, nginx_error, syslog (RFC 5424 or 3164 for each line), rfc3164, rfc5424, logfmt, json, w3c, grok), pattern (a grok pattern or an array of patterns, implies grok), definitions ({NAME: regex} for the patterns), timezone (UTC), year, types ({field: int | float | bool | string | timestamp}: a value that cannot be converted becomes null; int is exact on 64 bits, a larger integer is kept exactly as written, a decimal is cut toward zero), time_field (a field of json, logfmt or grok rows written in ISO 8601, epoch seconds and milliseconds accepted, a value that is not a date is left as it is), fields (the fields to keep, in this order), add_line (true: the number of the line first), useragent (true: ua with the result of log useragent for user_agent, agent or cs(User-Agent)), normalize_time (true), output (full, rows: only the rows, summary: no rows), max_unparsed (20, 10000 at most), max_lines (1000000), offset (0), line_max (1048576), line_timeout_ms (200), timeout_ms (60000: the whole reading, also inside a very long line)
Parameters
text: The log lines (a text without a real line break may separate its lines with the two characters \n; such a \n inside a double-quoted value is kept when the quote closes within the next 8 lines) - String - required
json_params: The parameters - String - required
text: The log lines (a text without a real line break may separate its lines with the two characters \n; such a \n inside a double-quoted value is kept when the quote closes within the next 8 lines) - String - required
json_params: The parameters - String - required
admin
log parse "2026-11-03 10:00:00,123 INFO [main] OrderService - order 42 saved in 15 ms 2026-11-03 10:00:01,456 ERROR [pool-1] OrderService - payment refused for order 43 not a line of this format" "{\"pattern\": \"%{TIMESTAMP_ISO8601:time} %{LOGLEVEL:level} \\[%{DATA:thread}\\] %{WORD:logger} - %{GREEDYDATA:message}\"}"
mentdb
{"format": "grok", "lines": 3, "parsed": 2, "unparsed": 1, "skipped": 0, "truncated": false, "rows": [{"time": "2026-11-03T10:00:00.123+00:00", "level": "INFO", "thread": "main", "logger": "OrderService", "message": "order 42 saved in 15 ms"}, {"time": "2026-11-03T10:00:01.456+00:00", "level": "ERROR", "thread": "pool-1", "logger": "OrderService", "message": "payment refused for order 43"}], "unparsed_lines": [{"line": 3, "reason": "no match", "text": "not a line of this format"}]}
Typed grok fields
admin
log parse "55.3.244.1 GET /index.html 15824 0.043" "{\"pattern\": \"%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes:int} %{NUMBER:duration:float}\", \"output\": \"rows\"}"
mentdb
[{"client": "55.3.244.1", "method": "GET", "request": "/index.html", "bytes": 15824, "duration": 0.043}]
RFC 3164: the year and the time zone are not in the line
admin
log parse "<34>Oct 11 22:14:15 mymachine su: 'su root' failed for lonvick on /dev/pts/8" "{\"year\": 2025, \"timezone\": \"Europe/Paris\"}"
mentdb
{"format": "rfc3164", "lines": 1, "parsed": 1, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"priority": 34, "facility": "auth", "severity": "crit", "timestamp": "2025-10-11T22:14:15+02:00", "hostname": "mymachine", "app_name": "su", "procid": null, "message": "'su root' failed for lonvick on /dev/pts/8"}], "unparsed_lines": []}
Visitors: only some fields, with the user agent read
admin
log parse "127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326 \"http://www.example.com/start.html\" \"Mozilla/4.08 [en] (Win98; I ;Nav)\"" "{\"fields\": [\"client\", \"timestamp\", \"status\", \"ua\"], \"useragent\": true, \"output\": \"rows\"}"
mentdb
[{"client": "127.0.0.1", "timestamp": "2000-10-10T13:55:36-07:00", "status": 200, "ua": {"browser": null, "browser_version": null, "os": "Windows", "os_version": "98", "device_type": "desktop", "device_brand": null, "device_model": null, "is_bot": false, "bot_name": null}}]
A common log line with its number, the status as text
admin
log parse "127.0.0.1 - frank [10/Oct/2000:13:55:36 -0700] \"GET /apache_pb.gif HTTP/1.0\" 200 2326" "{\"format\": \"apache_common\", \"add_line\": true, \"types\": {\"status\": \"string\"}, \"output\": \"rows\"}"
mentdb
[{"line": 1, "client": "127.0.0.1", "ident": null, "user": "frank", "timestamp": "2000-10-10T13:55:36-07:00", "request": "GET /apache_pb.gif HTTP/1.0", "method": "GET", "path": "/apache_pb.gif", "protocol": "HTTP/1.0", "status": "200", "bytes": 2326}]
log parse_file <path>
Description
Parse a log file as a stream, the format detected from the first 200 lines. Same result as log parse
Parse a log file as a stream, the format detected from the first 200 lines. Same result as log parse
Parameters
path: The log file (UTF-8 by default, a .gz file is read as it is), same rights as file load - String - required
path: The log file (UTF-8 by default, a .gz file is read as it is), same rights as file load - String - required
admin
jsonl write "tmp/doc_logs.jsonl" "[{\"ts\": 1762164000, \"level\": \"info\", \"msg\": \"start\"}, {\"ts\": 1762164060, \"level\": \"error\", \"msg\": \"disk full\"}]"; log parse_file "tmp/doc_logs.jsonl"
mentdb
{"format": "json", "lines": 2, "parsed": 2, "unparsed": 0, "skipped": 0, "truncated": false, "rows": [{"ts": 1762164000, "level": "info", "msg": "start"}, {"ts": 1762164060, "level": "error", "msg": "disk full"}], "unparsed_lines": []}
log parse_file <path> <json_params>
Description
Parse a log file with the parameters of log parse, and charset (UTF-8; bytes that are not valid become U+FFFD), max_bytes (52428800, 1 GB at most, counted after decompression)
Parse a log file with the parameters of log parse, and charset (UTF-8; bytes that are not valid become U+FFFD), max_bytes (52428800, 1 GB at most, counted after decompression)
Parameters
path: The log file (UTF-8 by default, a .gz file is read as it is), same rights as file load - String - required
json_params: The parameters - String - required
path: The log file (UTF-8 by default, a .gz file is read as it is), same rights as file load - String - required
json_params: The parameters - String - required
admin
jsonl write "tmp/doc_logs.jsonl" "[{\"ts\": 1762164000, \"level\": \"info\", \"msg\": \"start\"}, {\"ts\": 1762164060, \"level\": \"error\", \"msg\": \"disk full\"}]"; log parse_file "tmp/doc_logs.jsonl" "{\"offset\": 1, \"max_lines\": 1, \"time_field\": \"ts\", \"output\": \"rows\"}"
mentdb
[{"ts": "2025-11-03T10:01:00+00:00", "level": "error", "msg": "disk full"}]
Only the counts
admin
log parse_file "tmp/doc_logs.jsonl" "{\"output\": \"summary\"}"
mentdb
{"format": "json", "lines": 2, "parsed": 2, "unparsed": 0, "skipped": 0, "truncated": false, "unparsed_lines": []}
log grok_patterns
Description
The built-in grok patterns: a JSON object {NAME: regex}; a pattern may use other patterns with %{NAME}
The built-in grok patterns: a JSON object {NAME: regex}; a pattern may use other patterns with %{NAME}
admin
log grok_patterns
mentdb
{"USERNAME": "[a-zA-Z0-9._-]+", "USER": "%{USERNAME}", "EMAILLOCALPART": "[a-zA-Z0-9!#$%&'*+\\-/=?^_`{|}~]{1,64}(?:\\.[a-zA-Z0-9!#$%&'*+\\-/=?^_`{|}~]{1,62}){0,63}", "EMAILADDRESS": "%{EMAILLOCALPART}@%{HOSTNAME}", "INT": "(?:[+-]?(?:[0-9]+))", "BASE10NUM": "(?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\\.[0-9]+)?)|(?:\\.[0-9]+)))", "NUMBER": "(?:%{BASE10NUM})", "BASE16NUM": "(?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))", "BASE16FLOAT": "\\b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\\.[0-9A-Fa-f]*)?)|(?:\\.[0-9A-Fa-f]+)))\\b", "POSINT": "\\b(?:[1-9][0-9]*)\\b", "NONNEGINT": "\\b(?:[0-9]+)\\b", "WORD": "\\b\\w+\\b", "NOTSPACE": "\\S+", "SPACE": "\\s*", "DATA": ".*?", "GREEDYDATA": ".*", "QUOTEDSTRING": "(?>(?<!\\\\)(?>\"(?>\\\\.|[^\\\\\"]+)+\"|\"\"|(?>'(?>\\\\.|[^\\\\']+)+')|''|(?>`(?>\\\\.|[^\\\\`]+)+`)|``))", "QS": "%{QUOTEDSTRING}", "UUID": "[A-Fa-f0-9]{8}-(?:[A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}", "URN": "urn:[0-9A-Za-z][0-9A-Za-z-]{0,31}:(?:%[0-9a-fA-F]{2}|[0-9A-Za-z()+,.:=@;$_!*'/?#-])+", "CISCOMAC": "(?:(?:[A-Fa-f0-9]{4}\\.){2}[A-Fa-f0-9]{4})", "WINDOWSMAC": "(?:(?:[A-Fa-f0-9]{2}-){5}[A-Fa-f0-9]{2})", "COMMONMAC": "(?:(?:[A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2})", "MAC": "(?:%{CISCOMAC}|%{WINDOWSMAC}|%{COMMONMAC})", "IPV6": "((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?", "IPV4": "(?<![0-9])(?:(?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])[.](?:[0-1]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]))(?![0-9])", "IP": "(?:%{IPV6}|%{IPV4})", "HOSTNAME": "\\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\\.?|\\b)", "IPORHOST": "(?:%{IP}|%{HOSTNAME})", "HOSTPORT": "%{IPORHOST}:%{POSINT}", "UNIXPATH": "(/[\\p{Alnum}_%!$@:.,+~-]*)+", "TTY": "(?:/dev/(pts|tty([pq])?)(\\w+)?/?(?:[0-9]+))", "WINPATH": "(?>[A-Za-z]+:|\\\\)(?:\\\\[^\\\\?*]*)+", "PATH": "(?:%{UNIXPATH}|%{WINPATH})", "URIPROTO": "[A-Za-z]([A-Za-z0-9+\\-.]+)+", "URIHOST": "%{IPORHOST}(?::%{POSINT})?", "URIPATH": "(?:/[A-Za-z0-9$.+!*'(){},~:;=@#%&_\\-]*)+", "URIQUERY": "[A-Za-z0-9$.+!*'|(){},~@#%&/=:;_?\\-\\[\\]<>]*", "URIPARAM": "\\?%{URIQUERY}", "URIPATHPARAM": "%{URIPATH}(?:\\?%{URIQUERY})?", "URI": "%{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?(?:%{URIPATH}(?:\\?%{URIQUERY})?)?", "MONTH": "\\b(?:[Jj]an(?:uary|uar)?|[Ff]eb(?:ruary|ruar)?|[Mm](?:a|รค)?r(?:ch|z)?|[Aa]pr(?:il)?|[Mm]a(?:y|i)?|[Jj]un(?:e|i)?|[Jj]ul(?:y|i)?|[Aa]ug(?:ust)?|[Ss]ep(?:tember)?|[Oo](?:c|k)?t(?:ober)?|[Nn]ov(?:ember)?|[Dd]e(?:c|z)(?:ember)?)\\b", "MONTHNUM": "(?:0?[1-9]|1[0-2])", "MONTHNUM2": "(?:0[1-9]|1[0-2])", "MONTHDAY": "(?:(?:0[1-9])|(?:[12][0-9])|(?:3[01])|[1-9])", "DAY": "(?:Mon(?:day)?|Tue(?:sday)?|Wed(?:nesday)?|Thu(?:rsday)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)", "YEAR": "(?>\\d\\d){1,2}", "HOUR": "(?:2[0123]|[01]?[0-9])", "MINUTE": "(?:[0-5][0-9])", "SECOND": "(?:(?:[0-5]?[0-9]|60)(?:[:.,][0-9]+)?)", "TIME": "(?<![0-9])%{HOUR}:%{MINUTE}(?::%{SECOND})(?![0-9])", "DATE_US": "%{MONTHNUM}[/-]%{MONTHDAY}[/-]%{YEAR}", "DATE_EU": "%{MONTHDAY}[./-]%{MONTHNUM}[./-]%{YEAR}", "ISO8601_TIMEZONE": "(?:Z|[+-]%{HOUR}(?::?%{MINUTE}))", "ISO8601_SECOND": "%{SECOND}", "TIMESTAMP_ISO8601": "%{YEAR}-%{MONTHNUM}-%{MONTHDAY}[T ]%{HOUR}:?%{MINUTE}(?::?%{SECOND})?%{ISO8601_TIMEZONE}?", "DATE": "%{DATE_US}|%{DATE_EU}", "DATESTAMP": "%{DATE}[- ]%{TIME}", "TZ": "(?:[APMCE][SD]T|UTC)", "DATESTAMP_RFC822": "%{DAY} %{MONTH} %{MONTHDAY} %{YEAR} %{TIME} %{TZ}", "DATESTAMP_RFC2822": "%{DAY}, %{MONTHDAY} %{MONTH} %{YEAR} %{TIME} %{ISO8601_TIMEZONE}", "DATESTAMP_OTHER": "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{TZ} %{YEAR}", "DATESTAMP_EVENTLOG": "%{YEAR}%{MONTHNUM2}%{MONTHDAY}%{HOUR}%{MINUTE}%{SECOND}", "SYSLOGTIMESTAMP": "%{MONTH} +%{MONTHDAY} %{TIME}", "PROG": "[\\x21-\\x5a\\x5c\\x5e-\\x7e]+", "SYSLOGPROG": "%{PROG:program}(?:\\[%{POSINT:pid}\\])?", "SYSLOGHOST": "%{IPORHOST}", "SYSLOGFACILITY": "<%{NONNEGINT:facility}.%{NONNEGINT:priority}>", "SYSLOGBASE": "%{SYSLOGTIMESTAMP:timestamp} (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{SYSLOGPROG}:", "HTTPDATE": "%{MONTHDAY}/%{MONTH}/%{YEAR}:%{TIME} %{INT}", "LOGLEVEL": "([Aa]lert|ALERT|[Tt]race|TRACE|[Dd]ebug|DEBUG|[Nn]otice|NOTICE|[Ii]nfo?(?:rmation)?|INFO?(?:RMATION)?|[Ww]arn?(?:ing)?|WARN?(?:ING)?|[Ee]rr?(?:or)?|ERR?(?:OR)?|[Cc]rit?(?:ical)?|CRIT?(?:ICAL)?|[Ff]atal|FATAL|[Ss]evere|SEVERE|EMERG(?:ENCY)?|[Ee]merg(?:ency)?)", "HTTPDUSER": "%{EMAILADDRESS}|%{USER}", "HTTPDERROR_DATE": "%{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}", "COMMONAPACHELOG": "%{IPORHOST:clientip} %{HTTPDUSER:ident} %{HTTPDUSER:auth} \\[%{HTTPDATE:timestamp}\\] \"(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})\" %{NUMBER:response} (?:%{NUMBER:bytes}|-)", "COMBINEDAPACHELOG": "%{COMMONAPACHELOG} %{QS:referrer} %{QS:agent}"}
log useragent <user_agent>
Description
Read a user agent string: browser, browser_version, os, os_version, device_type (desktop, mobile, tablet, tv, console, bot or unknown), device_brand, device_model (Apple devices and the model written by Android), is_bot, bot_name. Robots, link previews, monitors and HTTP libraries (curl, python-requests, Go-http-client...) are bots. Chrome on iOS is Chrome, the mobile versions keep the name of the browser: the device type says mobile. Windows 11 sends the same text as Windows 10 and is given as 10; an iPad in desktop mode is a Mac. Compact hand-written rules, cut at 2048 characters, with a cache of 4096 user agents. Compared on the 18,038 user agents of the uap-core tests (Apache 2.0), many of them old phones: device type as the user-agents Python package on 93%, robot or not on 99%, browser family as ua-parser 1.0 on 85% (98% for the major version when the family is the same), OS family on 96%; on the 3,925 of them that use Chrome, Firefox, Safari, Edge, Opera or Samsung Internet: browser 98%, browser and major version 97%, OS 98%, device type 95%. The differences are mostly old feature phones and WAP browsers that MentDB does not name, and Android phones that user-agents calls tablets
Read a user agent string: browser, browser_version, os, os_version, device_type (desktop, mobile, tablet, tv, console, bot or unknown), device_brand, device_model (Apple devices and the model written by Android), is_bot, bot_name. Robots, link previews, monitors and HTTP libraries (curl, python-requests, Go-http-client...) are bots. Chrome on iOS is Chrome, the mobile versions keep the name of the browser: the device type says mobile. Windows 11 sends the same text as Windows 10 and is given as 10; an iPad in desktop mode is a Mac. Compact hand-written rules, cut at 2048 characters, with a cache of 4096 user agents. Compared on the 18,038 user agents of the uap-core tests (Apache 2.0), many of them old phones: device type as the user-agents Python package on 93%, robot or not on 99%, browser family as ua-parser 1.0 on 85% (98% for the major version when the family is the same), OS family on 96%; on the 3,925 of them that use Chrome, Firefox, Safari, Edge, Opera or Samsung Internet: browser 98%, browser and major version 97%, OS 98%, device type 95%. The differences are mostly old feature phones and WAP browsers that MentDB does not name, and Android phones that user-agents calls tablets
Parameters
user_agent: The User-Agent header - String - required
user_agent: The User-Agent header - String - required
admin
log useragent "Mozilla/5.0 (iPhone; CPU iPhone OS 17_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.1 Mobile/15E148 Safari/604.1"
mentdb
{"browser": "Safari", "browser_version": "17.1", "os": "iOS", "os_version": "17.1.2", "device_type": "mobile", "device_brand": "Apple", "device_model": "iPhone", "is_bot": false, "bot_name": null}
Edge on Windows
admin
log useragent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.2210.91"
mentdb
{"browser": "Edge", "browser_version": "120.0.2210.91", "os": "Windows", "os_version": "10", "device_type": "desktop", "device_brand": null, "device_model": null, "is_bot": false, "bot_name": null}
A robot
admin
log useragent "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
mentdb
{"browser": null, "browser_version": null, "os": null, "os_version": null, "device_type": "bot", "device_brand": null, "device_model": null, "is_bot": true, "bot_name": "Googlebot"}
Chrome on a Samsung phone
admin
log useragent "Mozilla/5.0 (Linux; Android 13; SM-S918B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36"
mentdb
{"browser": "Chrome", "browser_version": "119.0.0.0", "os": "Android", "os_version": "13", "device_type": "mobile", "device_brand": "Samsung", "device_model": "SM-S918B", "is_bot": false, "bot_name": null}
An Android tablet (no Mobile in the text)
admin
log useragent "Mozilla/5.0 (Linux; Android 12; SM-X200) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
mentdb
{"browser": "Chrome", "browser_version": "118.0.0.0", "os": "Android", "os_version": "12", "device_type": "tablet", "device_brand": "Samsung", "device_model": "SM-X200", "is_bot": false, "bot_name": null}
curl
admin
log useragent "curl/8.4.0"
mentdb
{"browser": null, "browser_version": null, "os": null, "os_version": null, "device_type": "bot", "device_brand": null, "device_model": null, "is_bot": true, "bot_name": "curl"}
