0

I have a very simple test setup. Data flow is as follows:

sample.log -> Promtail -> Loki -> Grafana

I am using this log file from microsoft: sample log file download link

I have promtail config as follows:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: C:\Users\user\Desktop\tmp\positions.yaml

clients:
  - url: http://localhost:3100/loki/api/v1/push

scrape_configs:
  - job_name: testing_logging_a_log_file
    static_configs:
        - targets:
            - localhost
          labels:
            job: testing_logging_a_log_file_labels_job_what_even_is_this
            host: testing_for_signs_of_life_probably_my_computer_name
            __path__: C:\Users\user\Desktop\sample.log
  - job_name: testing_logging_a_log_file_with_no_timestamp_test_2
    static_configs:
        - targets:
            - localhost
          labels:
            job: actor_v2
            host: ez_change
            __path__: C:\Users\user\Desktop\Actors_2.txt

Loki config:

auth_enabled: false

server:
  http_listen_port: 3100

ingester:
  lifecycler:
    address: 127.0.0.1
    ring:
      kvstore:
        store: inmemory
      replication_factor: 1
    final_sleep: 0s
  chunk_idle_period: 5m
  chunk_retain_period: 30s
  max_transfer_retries: 0

schema_config:
  configs:
    - from: 2018-04-15
      store: boltdb
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 168h

storage_config:
  boltdb:
    directory: C:\Users\user\Desktop\tmp\loki\index

  filesystem:
    directory: C:\Users\user\Desktop\tmp\loki\chunks

limits_config:
  enforce_metric_name: false
  reject_old_samples: True
  reject_old_samples_max_age: 168h

chunk_store_config:
  max_look_back_period: 0s

table_manager:
  retention_deletes_enabled: false
  retention_period: 0s

The sample files are read properly the first time. I can query WARN logs with: {host="testing_for_signs_of_life_probably_my_computer_name"} |= "WARN"

Problem arises when I manually add a new log line to the sample.log file. (To emulate log lines written to the file)

2012-02-03 20:11:56 SampleClass3 [WARN] missing id 42334089511

This new line is not visible in Grafana. Is there any particular config I must to know to make this happen?

Jeeva Bharathi
  • 514
  • 4
  • 22
  • Hi Jeeva, The new log line should be automatically shipped to Loki and reflected in Grafana. AFAIK there need not be done anything explicitly. Your promtail configuration looks all good to me. – H S Raju Oct 25 '21 at 11:23

2 Answers2

0

It was a problem with the network, if you remove the loki port and don't configure any network you can access it by putting http://loki:3100 in your grafana panel.

Illidan
  • 149
  • 1
  • 8
0

Yes, it's weird, when I append a line to a existed log file, it can't be seen in grafana explore.but ....try to do it again , append one more line, now the previous line is show in grafana

it happens when you using notepad, works well on notepad++

Shihao
  • 1
  • 1