{"by":"valyala","descendants":29,"id":40449299,"kids":[40477209,40476496,40476432,40477156,40477781,40477935,40476900],"score":61,"text":"I don&#x27;t like the existing query languages for Elasticsearch and Grafana Loki, because they are too awkward to use for typical logs&#x27; investigation cases. So I designed new query language - LogsQL - and wrote reference implementation for it as a part of VictoriaLogs - an open source database for logs. LogsQL is based on the following principles:<p>- Simplicity. It is easy to write typical queries over logs in it. For example, a single word `error` is a valid LogsQL query, which returns all the logs with the `error` word. Another example is `_time:5m error`, which returns all the logs with the &#x27;error&#x27; word over the last 5 minutes.<p>- Composable building blocks similar to Unix pipes, which allow powerful filtering, transforming and calculating stats over the selected logs. For example, `_time:5m error | stats count() as rows` returns the number of logs with the `error` word over the last 5 minutes.<p>- Readability. Typical LogsQL queries must be easy to read and understand even for persons unfamiliar with it.<p>Take a look at LogsQL docs [1] and try using VictoriaLogs [2] in production. If you like Unix way and KISS design principle, then you&#x27;ll enjoy LogsQL :)<p>[1] <a href=\"https:&#x2F;&#x2F;docs.victoriametrics.com&#x2F;victorialogs&#x2F;logsql&#x2F;\" rel=\"nofollow\">https:&#x2F;&#x2F;docs.victoriametrics.com&#x2F;victorialogs&#x2F;logsql&#x2F;</a><p>[2] <a href=\"https:&#x2F;&#x2F;docs.victoriametrics.com&#x2F;victorialogs&#x2F;\" rel=\"nofollow\">https:&#x2F;&#x2F;docs.victoriametrics.com&#x2F;victorialogs&#x2F;</a>","time":1716427708,"title":"Show HN: LogsQL – opinionated query language for logs","type":"story","url":"https://docs.victoriametrics.com/victorialogs/logsql/"}