VictoriaMetrics/docs/VictoriaLogs/QuickStart.md
2023-07-06 21:33:49 -07:00

5.0 KiB

VictoriaLogs Quick Start

It is recommended to read README and Key Concepts before you start working with VictoriaLogs.

How to install and run VictoriaLogs

There are the following options exist:

Docker image

You can run VictoriaLogs in a Docker container. It is the easiest way to start using VictoriaLogs. Here is the command to run VictoriaLogs in a Docker container:

docker run --rm -it -p 9428:9428 -v ./victoria-logs-data:/victoria-logs-data \
  docker.io/victoriametrics/victoria-logs:heads-public-single-node-0-ga638f5e2b

Helm charts

You can run VictoriaLogs in Kubernetes environment with helm-charts.

Building from source code

Follow the following steps in order to build VictoriaLogs from source code:

  • Checkout VictoriaLogs source code. It is located in the VictoriaMetrics repository:

    git clone https://github.com/VictoriaMetrics/VictoriaMetrics
    cd VictoriaMetrics
    
  • Build VictoriaLogs. The build command requires Go 1.20.

    make victoria-logs
    
  • Run the built binary:

    bin/victoria-logs
    

VictoriaLogs is ready for data ingestion and querying at the TCP port 9428 now! It has no any external dependencies, so it may run in various environments without additional setup and configuration. VictoriaLogs automatically adapts to the available CPU and RAM resources. It also automatically setups and creates the needed indexes during data ingestion.

How to configure VictoriaLogs

It is possible to change the TCP port via -httpListenAddr command-line flag. For example, the following command starts VictoriaLogs, which accepts incoming requests at port 9200 (aka ElasticSearch HTTP API port):

/path/to/victoria-logs -httpListenAddr=:9200

VictoriaLogs stores the ingested data to the victoria-logs-data directory by default. The directory can be changed via -storageDataPath command-line flag. See these docs for details.

By default VictoriaLogs stores log entries with timestamps in the time range [now-7d, now], while dropping logs outside the given time range. E.g. it uses the retention of 7 days. Read these docs on how to control the retention for the ingested logs.

It is recommended setting up monitoring of VictoriaLogs according to these docs.

How to send logs to VictoriaLogs

You can setup data ingestion for VictoriaLogs via the following ways:

Here are a demos for running popular supported log collectors in docker with VictoriaLogs:

And you can use helm chart as demo for running fluentbit in kubernetes with VictoriaLogs:

How to query logs in VictoriaLogs

You can query logs with LogsQL using the following options:

See more details in these docs.