### Install Faro-React Web SDK Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/grafana-cloud/monitor-applications/frontend-observability/quickstart/react First, add Faro-React to your project. Install the Faro-React package using either NPM or Yarn. ```sh # install globally npm i @grafana/faro-react ``` ```sh yarn add @grafana/faro-react ``` -------------------------------- ### Example `logcli volume_range` Command Execution Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started An example demonstrating how to use `logcli volume_range` with specific time ranges, timezone, step, and a log query. This provides a practical illustration of the command's parameters. ```shell logcli volume_range --timezone=UTC --from="2021-01-19T10:00:00Z" --to="2021-01-19T20:00:00Z" --step=1h 'my-query' ``` -------------------------------- ### Install LogCLI binary to PATH Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started Optionally move the compiled `logcli` binary into a directory that is part of your system's `$PATH` environment variable. This allows you to run `logcli` from any directory without specifying its full path. ```bash cp cmd/logcli/logcli /usr/local/bin/logcli ``` -------------------------------- ### logcli query Example: Listing Parallel Download Part Files Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started Provides an example of listing the temporary and completed part files generated during a parallel `logcli query` operation when `--keep-parts` is enabled. ```shell $ ls -1 /tmp/my_query* /tmp/my_query_20210119T183000_20210119T184500.part.tmp /tmp/my_query_20210119T184500_20210119T190000.part.tmp /tmp/my_query_20210119T190000_20210119T191500.part.tmp /tmp/my_query_20210119T191500_20210119T193000.part.tmp /tmp/my_query_20210119T193000_20210119T194500.part ``` -------------------------------- ### Initialize Faro-React with minimum setup Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/grafana-cloud/monitor-applications/frontend-observability/quickstart/react Add this code snippet to your project to import and initialize Faro-React. This minimum setup is required to get insights into the health and performance of your application or website, sending data to the specified Grafana collector URL and identifying your application by name. ```ts import { initializeFaro } from '@grafana/faro-react'; initializeFaro({ // required: the URL of the Grafana collector url: 'my/collector/url', // required: the identification label of your application app: { name: 'my-react-app', }, }); ``` -------------------------------- ### Logcli Stdin Usage Examples Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started Practical examples demonstrating how to use the `logcli --stdin` argument with various LogQL features such as line filtering, label matching, different parsers (logfmt, json, pattern, regexp), and line formatters. ```bash cat mylog.log | logcli --stdin query '|="too many open connections"' ``` ```bash echo 'msg="timeout happened" level="warning"' | logcli --stdin query '|logfmt|level="warning"' ``` ```bash cat mylog.log | logcli --stdin query '|pattern - - <_> " <_>" <_> "" <_>' ``` ```bash cat mylog.log | logcli --stdin query '|logfmt|line_format "{{.query}} {{.duration}}"' ``` -------------------------------- ### logcli: Check installed version Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/latest/query/logcli/getting-started Provides the command to check the currently installed version of the `logcli` utility, which is useful for troubleshooting compatibility issues with Loki. ```bash logcli –version ``` -------------------------------- ### LogCLI Command-Line Utility Help Output Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/latest/query/logcli/getting-started Displays the full help output for the `logcli` command, detailing all available flags, their descriptions, default values, and corresponding environment variables for configuration. This output serves as a comprehensive guide for using `logcli` to interact with Loki. ```shell usage: logcli [] [ ...] A command-line for loki. Flags: --[no-]help Show context-sensitive help (also try --help-long and --help-man). --[no-]version Show application version. -q, --[no-]quiet Suppress query metadata --[no-]stats Show query statistics -o, --output=default Specify output mode [default, raw, jsonl]. raw suppresses log labels and timestamp. -z, --timezone=Local Specify the timezone to use when formatting output timestamps [Local, UTC] --output-timestamp-format=rfc3339 Specify the format of timestamps in the default output mode [rfc3339, rfc3339nano, rfc822z, rfc1123z, stampmicro, stampmilli, stampnano, unixdate] --cpuprofile="" Specify the location for writing a CPU profile. --memprofile="" Specify the location for writing a memory profile. --[no-]stdin Take input logs from stdin --addr="http://localhost:3100" Server address. Can also be set using LOKI_ADDR env var. ($LOKI_ADDR) --username="" Username for HTTP basic auth. Can also be set using LOKI_USERNAME env var. ($LOKI_USERNAME) --password="" Password for HTTP basic auth. Can also be set using LOKI_PASSWORD env var. ($LOKI_PASSWORD) --ca-cert="" Path to the server Certificate Authority. Can also be set using LOKI_CA_CERT_PATH env var. ($LOKI_CA_CERT_PATH) --[no-]tls-skip-verify Server certificate TLS skip verify. Can also be set using LOKI_TLS_SKIP_VERIFY env var. ($LOKI_TLS_SKIP_VERIFY) --cert="" Path to the client certificate. Can also be set using LOKI_CLIENT_CERT_PATH env var. ($LOKI_CLIENT_CERT_PATH) --key="" Path to the client certificate key. Can also be set using LOKI_CLIENT_KEY_PATH env var. ($LOKI_CLIENT_KEY_PATH) --org-id="" adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when bypassing an auth gateway. Can also be set using LOKI_ORG_ID env var. ($LOKI_ORG_ID) --query-tags="" adds X-Query-Tags http header to API requests. This header value will be part of `metrics.go` statistics. Useful for tracking the query. Can also be set using LOKI_QUERY_TAGS env var. ($LOKI_QUERY_TAGS) --[no-]nocache adds Cache-Control: no-cache http header to API requests. Can also be set using LOKI_NO_CACHE env var. ($LOKI_NO_CACHE) --bearer-token="" adds the Authorization header to API requests for authentication purposes. Can also be set using LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN) --bearer-token-file="" adds the Authorization header to API requests for authentication purposes. Can also be set using LOKI_BEARER_TOKEN_FILE env var. ($LOKI_BEARER_TOKEN_FILE) --retries=0 How many times to retry each query when getting an error response from Loki. Can also be set using LOKI_CLIENT_RETRIES env var. ($LOKI_CLIENT_RETRIES) --min-backoff=0 Minimum backoff time between retries. Can also be set using LOKI_CLIENT_MIN_BACKOFF env var. ($LOKI_CLIENT_MIN_BACKOFF) --max-backoff=0 Maximum backoff time between retries. Can also be set using LOKI_CLIENT_MAX_BACKOFF env var. ($LOKI_CLIENT_MAX_BACKOFF) --auth-header="Authorization" The authorization header used. Can also be set using LOKI_AUTH_HEADER env var. ($LOKI_AUTH_HEADER) --proxy-url="" The http or https proxy to use when ``` -------------------------------- ### Logcli --stdin Examples for Local LogQL Queries Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/latest/query/logcli/getting-started Practical examples demonstrating the use of `logcli --stdin` to query local log files with LogQL, covering line filtering, label matching, various parsers (logfmt, json, pattern, regexp), and line formatters. ```shell cat mylog.log | logcli --stdin query '|=\"too many open connections\"' ``` ```shell echo 'msg=\"timeout happened\" level=\"warning\"' | logcli --stdin query '|logfmt|level=\"warning\"' ``` ```shell cat mylog.log | logcli --stdin query '|pattern - - <_> \" <_>\" <_> \"\" <_>' ``` ```shell cat mylog.log | logcli --stdin query '|logfmt|line_format \"{{.query}} {{.duration}}\"' ``` -------------------------------- ### Check logcli Version Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started Provides the command to check the installed version of the `logcli` utility, which is useful for troubleshooting compatibility issues with Loki. ```bash logcli –version ``` -------------------------------- ### Navigate to Tempo Docker Compose Local Example Directory Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/tempo/latest/getting-started/docker-example Changes the current directory to the specific Docker Compose local example within the cloned Tempo repository, where the `docker-compose.yaml` file is located. ```bash cd tempo/example/docker-compose/local ``` -------------------------------- ### Full Grafana Docker Configuration Example Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/grafana/latest/setup-grafana/installation/docker This comprehensive example combines creating a Docker volume, starting Grafana with persistent storage, setting a custom server root URL, and pre-installing a plugin. It demonstrates a typical, robust setup for a Grafana Docker instance. ```bash # create a persistent volume for your data docker volume create grafana-storage # start grafana by using the above persistent storage # and defining environment variables docker run -d -p 3000:3000 --name=grafana \ --volume grafana-storage:/var/lib/grafana \ -e "GF_SERVER_ROOT_URL=http://my.grafana.server/" \ -e "GF_PLUGINS_PREINSTALL=grafana-clock-panel" \ grafana/grafana-enterprise ``` -------------------------------- ### logcli query Example: Parallel Log Download Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started This advanced example demonstrates using `logcli query` to parallelize log downloads over a 10-hour period. It sets each job duration to 15 minutes, uses 4 workers, specifies a temporary directory for part files, and merges the results, explaining how jobs are distributed and processed. ```shell logcli query --timezone=UTC --from="2021-01-19T10:00:00Z" --to="2021-01-19T20:00:00Z" --output=jsonl --parallel-duration="15m" --parallel-max-workers="4" --part-path-prefix="/tmp/my_query" --merge-parts 'my-query' ``` -------------------------------- ### Example: Run logcli stats with specific time range and timezone Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started An example demonstrating how to use the `logcli stats` command to query data within a specific time range (`--from`, `--to`) and timezone (`--timezone`), along with a sample query. ```shell logcli stats --timezone=UTC --from="2021-01-19T10:00:00Z" --to="2021-01-19T20:00:00Z" 'my-query' ``` -------------------------------- ### Grafana Mimir Demo Configuration Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-metrics/latest/get-started A sample YAML configuration file for a Grafana Mimir demonstration setup, defining storage, compactor, distributor, ingester, ruler, server, and store gateway settings. ```yaml multitenancy_enabled: false blocks_storage: backend: filesystem bucket_store: sync_dir: /tmp/mimir/tsdb-sync filesystem: dir: /tmp/mimir/data/tsdb tsdb: dir: /tmp/mimir/tsdb compactor: data_dir: /tmp/mimir/compactor sharding_ring: kvstore: store: memberlist distributor: ring: instance_addr: 127.0.0.1 kvstore: store: memberlist ingester: ring: instance_addr: 127.0.0.1 kvstore: store: memberlist replication_factor: 1 ruler_storage: backend: filesystem filesystem: dir: /tmp/mimir/rules server: http_listen_port: 9009 log_level: error store_gateway: sharding_ring: replication_factor: 1 ``` -------------------------------- ### Loki Client Command-Line Arguments Reference Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started Reference for command-line arguments available for configuring a Loki client, including network settings, authentication, time windows, and data aggregation. Each argument's purpose, default value, and corresponding environment variable are detailed, along with an example query. ```APIDOC --retries=0 Number of retries for client requests. Can also be set using LOKI_CLIENT_RETRIES env var. ($LOKI_CLIENT_RETRIES) --min-backoff=0 Minimum backoff time between retries. Can also be set using LOKI_CLIENT_MIN_BACKOFF env var. ($LOKI_CLIENT_MIN_BACKOFF) --max-backoff=0 Maximum backoff time between retries. Can also be set using LOKI_CLIENT_MAX_BACKOFF env var. ($LOKI_CLIENT_MAX_BACKOFF) --auth-header="Authorization" The authorization header used. Can also be set using LOKI_AUTH_HEADER env var. ($LOKI_AUTH_HEADER) --proxy-url="" The http or https proxy to use when making requests. Can also be set using LOKI_HTTP_PROXY_URL env var. ($LOKI_HTTP_PROXY_URL) --[no-]compress Request that Loki compress returned data in transit. Can also be set using LOKI_HTTP_COMPRESSION env var. ($LOKI_HTTP_COMPRESSION) --[no-]envproxy Use ProxyFromEnvironment to use net/http ProxyFromEnvironment configuration, eg HTTP_PROXY ($LOKI_ENV_PROXY) --since=1h Lookback window. --from=FROM Start looking for logs at this absolute time (inclusive) --to=TO Stop looking for logs at this absolute time (exclusive) --limit=30 Limit on number of series to return volumes for. --targetLabels=TARGETLABELS ... List of labels to aggregate results into. --[no-]aggregateByLabels Whether to aggregate results by label name only. Args: eg '{foo="bar",baz=~".*blip"}' ``` -------------------------------- ### List logcli query part files during parallel download Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started Example showing the temporary and completed part files generated by `logcli` when using parallel query execution with the `--keep-parts` flag. This helps in understanding the internal working of parallel downloads. ```Shell $ ls -1 /tmp/my_query* /tmp/my_query_20210119T183000_20210119T184500.part.tmp /tmp/my_query_20210119T184500_20210119T190000.part.tmp /tmp/my_query_20210119T190000_20210119T191500.part.tmp /tmp/my_query_20210119T191500_20210119T193000.part.tmp /tmp/my_query_20210119T193000_20210119T194500.part ``` -------------------------------- ### Clone Loki Fundamentals Repository Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/get-started/quick-start/tutorial Clones the `loki-fundamentals` repository from GitHub and checks out the `getting-started` branch, which contains the necessary files for the quickstart deployment. ```bash git clone https://github.com/grafana/loki-fundamentals.git -b getting-started ``` -------------------------------- ### Install MinIO Storage Backend Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/tempo/latest/setup/operator/quickstart Deploys MinIO as a local storage backend for Grafana Tempo within the Kubernetes cluster, suitable for quick start and testing purposes. ```shell kubectl apply -f https://raw.githubusercontent.com/grafana/tempo-operator/main/minio.yaml ``` -------------------------------- ### logcli Command Overview Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started An overview of the main commands available in `logcli`, including `help` for general assistance and `query` for executing LogQL queries. ```APIDOC help [...] Description: Show help for logcli or a specific command. query [] Description: Run a LogQL query. ``` -------------------------------- ### Install Grafana Foundation SDK for Go Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/grafana/latest/observability-as-code/foundation-sdk Instructions to install the Grafana Foundation SDK package using `go get` for Go projects. This command fetches and installs the Go module for the SDK. ```Go go get github.com/grafana/grafana-foundation-sdk/go ``` -------------------------------- ### Start Docker Compose Services Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/tempo/latest/setup/linux Starts all services defined in the `docker-compose.yaml` file in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Build LogCLI from source Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started Instructions to clone the Loki repository and build the `logcli` binary from its source code. This is an alternative to downloading a pre-built binary and ensures you have the latest development version. ```bash git clone https://github.com/grafana/loki.git cd loki make logcli ``` -------------------------------- ### Start Grafana Stack with Docker Compose on Windows Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/alloy/latest/monitor/monitor-windows Commands to navigate into the 'alloy-scenarios/windows' directory and start the Grafana stack using Docker Compose in detached mode. This deploys the necessary services for the monitoring example. ```shell cd alloy-scenarios/windows docker compose up -d ``` -------------------------------- ### Logcli volume_range Command Line Reference and Flags Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started Provides the full command-line help output for `logcli volume_range`, including its usage, a detailed explanation of its functionality, and an example of how to use it with specific time ranges and steps. It also lists all available flags and their descriptions in a structured API documentation format. ```shell usage: logcli volume_range [] Run a volume query and return timeseries data. The "volume_range" command will take the provided label selector(s) and return aggregate volumes for series matching those volumes, aggregated into buckets according to the step value. This only works against Loki instances using the TSDB index format. By default we look over the last hour of data; use --since to modify or provide specific start and end times with --from and --to respectively. Notice that when using --from and --to then ensure to use RFC3339Nano time format, but without timezone at the end. The local timezone will be added automatically or if using --timezone flag. Example: logcli volume_range --timezone=UTC --from="2021-01-19T10:00:00Z" --to="2021-01-19T20:00:00Z" --step=1h 'my-query' Flags: --[no-]help Show context-sensitive help (also try --help-long and --help-man). --[no-]version Show application version. -q, --[no-]quiet Suppress query metadata --[no-]stats Show query statistics -o, --output=default Specify output mode [default, raw, jsonl]. raw suppresses log labels and timestamp. -z, --timezone=Local Specify the timezone to use when formatting output timestamps [Local, UTC] --output-timestamp-format=rfc3339 Specify the format of timestamps in the default output mode [rfc3339, rfc3339nano, rfc822z, rfc1123z, stampmicro, stampmilli, stampnano, unixdate] --cpuprofile="" Specify the location for writing a CPU profile. --memprofile="" Specify the location for writing a memory profile. --[no-]stdin Take input logs from stdin --addr="http://localhost:3100" Server address. Can also be set using LOKI_ADDR env var. ($LOKI_ADDR) --username="" Username for HTTP basic auth. Can also be set using LOKI_USERNAME env var. ($LOKI_USERNAME) --password="" Password for HTTP basic auth. Can also be set using LOKI_PASSWORD env var. ($LOKI_PASSWORD) --ca-cert="" Path to the server Certificate Authority. Can also be set using LOKI_CA_CERT_PATH env var. ($LOKI_CA_CERT_PATH) --[no-]tls-skip-verify Server certificate TLS skip verify. Can also be set using LOKI_TLS_SKIP_VERIFY env var. ($LOKI_TLS_SKIP_VERIFY) --cert="" Path to the client certificate. Can also be set using LOKI_CLIENT_CERT_PATH env var. ($LOKI_CLIENT_CERT_PATH) --key="" Path to the client certificate key. Can also be set using LOKI_CLIENT_KEY_PATH env var. ($LOKI_CLIENT_KEY_PATH) --org-id="" adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when bypassing an auth gateway. Can also be set using LOKI_ORG_ID env var. ($LOKI_ORG_ID) --query-tags="" adds X-Query-Tags http header to API requests. This header value will be part of `metrics.go` statistics. Useful for tracking the query. Can also be set using LOKI_QUERY_TAGS env var. ($LOKI_QUERY_TAGS) --[no-]nocache adds Cache-Control: no-cache http header to API requests. Can also be set using LOKI_NO_CACHE env var. ($LOKI_NO_CACHE) --bearer-token="" adds the Authorization header to API requests for authentication purposes. Can also be set using LOKI_BEARER_TOKEN env var. ($LOKI_BEARER_TOKEN) --bearer-token-file="" adds the Authorization header to API requests for authentication purposes. Can also be set using LOKI_BEARER_TOKEN_FILE env var. ($LOKI_BEARER_TOKEN_FILE) ``` ```APIDOC Command: logcli volume_range Description: Run a volume query and return timeseries data. Flags: - Name: help Type: boolean Description: Show context-sensitive help (also try --help-long and --help-man). - Name: version Type: boolean Description: Show application version. - Name: quiet Alias: q Type: boolean Description: Suppress query metadata. - Name: stats Type: boolean Description: Show query statistics. - Name: output Alias: o Type: string Default: default Description: Specify output mode [default, raw, jsonl]. raw suppresses log labels and timestamp. - Name: timezone Alias: z Type: string Default: Local Description: Specify the timezone to use when formatting output timestamps [Local, UTC]. - Name: output-timestamp-format Type: string Default: rfc3339 Description: Specify the format of timestamps in the default output mode [rfc3339, rfc3339nano, rfc822z, rfc1123z, stampmicro, stampmilli, stampnano, unixdate]. - Name: cpuprofile Type: string Default: "" Description: Specify the location for writing a CPU profile. - Name: memprofile Type: string Default: "" Description: Specify the location for writing a memory profile. - Name: stdin Type: boolean Description: Take input logs from stdin. - Name: addr Type: string Default: "http://localhost:3100" Description: Server address. EnvVar: LOKI_ADDR - Name: username Type: string Default: "" Description: Username for HTTP basic auth. EnvVar: LOKI_USERNAME - Name: password Type: string Default: "" Description: Password for HTTP basic auth. EnvVar: LOKI_PASSWORD - Name: ca-cert Type: string Default: "" Description: Path to the server Certificate Authority. EnvVar: LOKI_CA_CERT_PATH - Name: tls-skip-verify Type: boolean Description: Server certificate TLS skip verify. EnvVar: LOKI_TLS_SKIP_VERIFY - Name: cert Type: string Default: "" Description: Path to the client certificate. EnvVar: LOKI_CLIENT_CERT_PATH - Name: key Type: string Default: "" Description: Path to the client certificate key. EnvVar: LOKI_CLIENT_KEY_PATH - Name: org-id Type: string Default: "" Description: adds X-Scope-OrgID to API requests for representing tenant ID. Useful for requesting tenant data when bypassing an auth gateway. EnvVar: LOKI_ORG_ID - Name: query-tags Type: string Default: "" Description: adds X-Query-Tags http header to API requests. This header value will be part of `metrics.go` statistics. Useful for tracking the query. EnvVar: LOKI_QUERY_TAGS - Name: nocache Type: boolean Description: adds Cache-Control: no-cache http header to API requests. EnvVar: LOKI_NO_CACHE - Name: bearer-token Type: string Default: "" Description: adds the Authorization header to API requests for authentication purposes. EnvVar: LOKI_BEARER_TOKEN - Name: bearer-token-file Type: string Default: "" Description: adds the Authorization header to API requests for authentication purposes. EnvVar: LOKI_BEARER_TOKEN_FILE ``` -------------------------------- ### Run Grafana Mimir using Local Binary Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-metrics/latest/get-started Command to start Grafana Mimir using a local executable and a specified configuration file. ```bash ./mimir --config.file=./demo.yaml ``` -------------------------------- ### Basic Promtail Configuration for Loki Log Shipping Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/get-started/labels This Promtail configuration provides a minimal setup to scrape system logs from `/var/log/syslog`. It assigns a `job: syslog` label to these logs, resulting in a single log stream being created in Loki. This is a fundamental example for getting started with Promtail. ```yaml scrape_configs: - job_name: system pipeline_stages: static_configs: - targets: - localhost labels: job: syslog __path__: /var/log/syslog ``` -------------------------------- ### Start Grafana Container for Basic Setup Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/grafana/latest/setup-grafana/installation/docker Execute this command in the directory containing your `docker-compose.yaml` to start the Grafana container in the background for the basic setup. ```bash docker compose up -d ``` -------------------------------- ### Logcli Query Example with Parallel Log Download Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/latest/query/logcli/getting-started Shows how to configure `logcli query` for parallel log downloads, specifying duration per job, maximum workers, part file prefix, and merging behavior. This allows for efficient retrieval of large log volumes. ```shell logcli query --timezone=UTC --from="2021-01-19T10:00:00Z" --to="2021-01-19T20:00:00Z" --output=jsonl --parallel-duration="15m" --parallel-max-workers="4" --part-path-prefix="/tmp/my_query" --merge-parts 'my-query' ``` -------------------------------- ### Listing logcli query Part Files Example Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/query/logcli/getting-started This example shows the expected output when listing part files generated by a parallel `logcli query` operation with the `--keep-parts` flag enabled. It illustrates the naming convention for temporary (`.part.tmp`) and completed (`.part`) files, indicating the time range covered by each part. ```shell $ ls -1 /tmp/my_query* /tmp/my_query_20210119T183000_20210119T184500.part.tmp /tmp/my_query_20210119T184500_20210119T190000.part.tmp /tmp/my_query_20210119T190000_20210119T191500.part.tmp /tmp/my_query_20210119T191500_20210119T193000.part.tmp /tmp/my_query_20210119T193000_20210119T194500.part /tmp/my_query_20210119T194500_20210119T200000.part ``` -------------------------------- ### Logcli Query with Parallel Download Configuration Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started Shows an example of using `logcli query` to download logs in parallel. It configures the query to split the 10-hour duration into 15-minute jobs, processed by 4 workers, saving parts to a specified prefix and merging them. ```shell logcli query --timezone=UTC --from="2021-01-19T10:00:00Z" --to="2021-01-19T20:00:00Z" --output=jsonl --parallel-duration="15m" --parallel-max-workers="4" --part-path-prefix="/tmp/my_query" --merge-parts 'my-query' ``` -------------------------------- ### Install Grafana Foundation SDK for Python Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/grafana/latest/observability-as-code/foundation-sdk Instructions to install the Grafana Foundation SDK package using `pip` for Python projects. This command installs the Python package from PyPI. ```bash pip install grafana-foundation-sdk ``` -------------------------------- ### Create Loki demo directory and navigate into it (Bash) Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/enterprise-logs/latest/get-started/quick-start/quick-start This command creates a new directory named `evaluate-loki` for the Loki demo environment and then changes the current working directory to it. This is the initial setup step for the local installation. ```bash mkdir evaluate-loki cd evaluate-loki ``` -------------------------------- ### Loki Command Line Arguments Source: https://grafana.com/docs/grafana-cloud/alerting-and-irm/irm/reference/incident-api/reference/loki/next/query/logcli/getting-started Documentation for command-line arguments used with Loki, covering network configuration (proxy, compression), environment variable integration, and time-range specifications for querying labels. ```APIDOC making requests. Can also be set using LOKI_HTTP_PROXY_URL env var. ($LOKI_HTTP_PROXY_URL) --[no-]compress Request that Loki compress returned data in transit. Can also be set using LOKI_HTTP_COMPRESSION env var. ($LOKI_HTTP_COMPRESSION) --[no-]envproxy Use ProxyFromEnvironment to use net/http ProxyFromEnvironment configuration, eg HTTP_PROXY ($LOKI_ENV_PROXY) --since=1h Lookback window. --from=FROM Start looking for labels at this absolute time (inclusive) --to=TO Stop looking for labels at this absolute time (exclusive) Args: [