-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update README.md * Update README.md * Update README.md * Update tanka.md * content edits * Create install-for-manual-build.md * Update README.md * Update helm.md * Update local.md * Create get-logs-into-loki.md * Update local.md * Update get-logs-into-loki.md * Update get-logs-into-loki.md * Update local.md * Update get-logs-into-loki.md * Update README.md * Update README.md * Update installation.md * Update README.md * Update docs/getting-started/get-logs-into-loki.md Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com> * Update docs/installation/local.md Co-authored-by: Owen Diehl <ow.diehl@gmail.com> * Update docs/installation/local.md Co-authored-by: Owen Diehl <ow.diehl@gmail.com> * applied edits * Update docs/getting-started/get-logs-into-loki.md Co-authored-by: Ed Welch <edward.welch@grafana.com> * Update get-logs-into-loki.md * Update docs/getting-started/get-logs-into-loki.md Co-authored-by: Ed Welch <edward.welch@grafana.com> * Update docs/getting-started/get-logs-into-loki.md Co-authored-by: Ed Welch <edward.welch@grafana.com> * Update docs/installation/README.md Co-authored-by: Ed Welch <edward.welch@grafana.com> * applied edits * Update local.md Co-authored-by: Cyril Tovena <cyril.tovena@gmail.com> Co-authored-by: Owen Diehl <ow.diehl@gmail.com> Co-authored-by: Ed Welch <edward.welch@grafana.com>
- Loading branch information
1 parent
15378cf
commit 687662e
Showing
10 changed files
with
208 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Get logs into Loki | ||
|
||
After you [install and run Loki](./installation/local.md), you probably want to get logs from other applications into it. | ||
|
||
To get application logs into Loki, you need to edit the [Promtail](./clients/promtail/README.md) config file. | ||
|
||
Detailed information about configuring Promtail is available in [Promtail configuration](./clients/promtail/configuration.md). | ||
|
||
The following instructions should help you get started. | ||
|
||
1. If you haven't already, download a Promtail configuration file. Keep track of where it is, because you will need to cite it when you run the binary. | ||
|
||
``` | ||
wget https://github.com/grafana/loki/blob/master/cmd/promtail/promtail-local-config.yaml | ||
``` | ||
|
||
2. Open the config file in the text editor of your choice. It should look similar to this: | ||
|
||
``` | ||
server: | ||
http_listen_port: 9080 | ||
grpc_listen_port: 0 | ||
positions: | ||
filename: /tmp/positions.yaml | ||
clients: | ||
- url: http://loki:3100/loki/api/v1/push | ||
scrape_configs: | ||
- job_name: system | ||
static_configs: | ||
- targets: | ||
- localhost | ||
labels: | ||
job: varlogs | ||
__path__: /var/log/*log | ||
``` | ||
|
||
The seven lines under `scrape_configs` are what send the logs that Loki generates to Loki, which then outputs them in the command line and http://localhost:3100/metrics. | ||
|
||
3. Copy the seven lines under `scrape_configs`, and then paste them under the original job (you can also just edit the original seven lines). | ||
|
||
Below is an example that sends logs from a default Grafana installation to Loki. We updated the following fields: | ||
- job_name - This differentiates the logs collected from other log groups. | ||
- targets - Optional for static_configs, however is often defined because in older versions of Promtail it was not optional. This was an artifact from directly using the Prometheus service discovery code which required this entry. | ||
- labels - Static label to apply to every log line scraped by this definition. Good examples would be environment name, job name, or app name. | ||
- __path__ - The path to where the logs are stored that I want Loki to consume. | ||
|
||
``` | ||
- job_name: grafana | ||
static_configs: | ||
- targets: | ||
- grafana | ||
labels: | ||
job: grafana | ||
__path__: "C:/Program Files/GrafanaLabs/grafana/data/log/grafana.log" | ||
``` | ||
|
||
4. Enter the following command to run Promtail. Examples below assume you have put the config file in the same directory as the binary. | ||
|
||
**Windows** | ||
|
||
``` | ||
`.\promtail-windows-amd64.exe --config.file=promtail-local-config.yaml` | ||
``` | ||
|
||
**Linux** | ||
|
||
``` | ||
./promtail-linux-amd64 -config.file=promtail-local-config.yaml | ||
``` | ||
|
||
You should now see your application logs. If you are using Grafana, you might need to refresh your instance in order to see the logs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
# Installing Loki | ||
# Install Loki | ||
|
||
1. [Installing using Tanka (recommended)](./tanka.md) | ||
2. [Installing through Helm](./helm.md) | ||
3. [Installing through Docker or Docker Compose](./docker.md) | ||
4. [Installing locally](./local.md) | ||
## Installation methods | ||
|
||
Instructions for different methods of installing Loki and Promtail. | ||
|
||
- [Install using Tanka (recommended)](./tanka.md) | ||
- [Install through Helm](./helm.md) | ||
- [Install through Docker or Docker Compose](./docker.md) | ||
- [Install and run locally](./local.md) | ||
- [Install from source](./install-from-source.md) | ||
|
||
## General process | ||
|
||
In order to run Loki, you must: | ||
|
||
1. Download and install both Loki and Promtail. | ||
1. Download config files for both programs. | ||
1. Start Loki. | ||
1. Update the Promtail config file to get your logs into Loki. | ||
1. Start Promtail. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Build from source | ||
|
||
In order to build Loki manually, you need to clone the GitHub repo and then `make Loki`. | ||
|
||
## Prerequisites | ||
|
||
- Go 1.13 or later | ||
- Make | ||
- Docker (for updating protobuf files and yacc files) | ||
|
||
## Build manually on your local system | ||
|
||
Clone Loki to `$GOPATH/src/github.com/grafana/loki`: | ||
|
||
```bash | ||
git clone https://github.com/grafana/loki $GOPATH/src/github.com/grafana/loki | ||
``` | ||
|
||
Then change into that directory and run `make loki`: | ||
|
||
```bash | ||
cd $GOPATH/src/github.com/grafana/loki | ||
make loki | ||
``` | ||
|
||
A file at ./cmd/loki/loki will be created and is the final built binary. |
Oops, something went wrong.