K
K
kondratev-ad2022-02-15 18:17:31
Journaling
kondratev-ad, 2022-02-15 18:17:31

How to collect logs using Promtail?

Hello everyone, I'm trying to collect logs using promtail + loki + grafana.
The log file inside looks like:

{"asctime": "2022-02-15 13:19:1644931152", "levelname": "INFO", "module": "name_modul", "funcName": "info", "lineno": 18, "message": "messange for your informations"}

I'm trying to run promtail with this configuration:
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: incoming
  pipeline_stages:
  - json:
      expressions:
        messange: message
        timestamp: asctime
        funcName: funcName
  - timestamp:
    source: timestamp
  - labels:
    timestamp:
    funcName:
  - output:
    source: message
    
  static_configs:
  - targets:
      - localhost
    labels:
      job: logs
      __path__: lib/docker/volumes/my_volume/_data/logfile.log

The container does not start, it issues
Unable to parse config: /etc/promtail/config.yml: yaml: line 16: found character that cannot start any token

Line 16 is messange: message, I did everything like in the documentation. Tell me what's wrong?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question