Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debuggin and tracing write Loki setup and connection #482

Open
aslom opened this issue Aug 31, 2023 · 1 comment
Open

Debuggin and tracing write Loki setup and connection #482

aslom opened this issue Aug 31, 2023 · 1 comment

Comments

@aslom
Copy link

aslom commented Aug 31, 2023

Is there a flag or some other way to see DEBUG/ or TRACE log with connection to Loki and what is sent there?

Right now I have simple pipeline with

  - name: write_loki
    write:
      type: loki
      loki:
        url: http://localhost:3100
        staticLabels:
          job: flowlogs-pipeline

and it runs without errors (and no output) even if there is nothing on localhost:3100 ( checked with curl -v localhost:3100/ready fails)

@ronensc
@eranra

@ronensc
Copy link
Collaborator

ronensc commented Sep 5, 2023

When setting the log level to trace, FLP emits a log message for every flowlog passing through the WriteLoki stage.

log.Tracef("writing entry: %#v", entry)

FLP uses loki-client-go to send the flowlog to Loki. loki-client-go is async. It waits for a full batch or for some timeout to expire before actually sending the flowlogs to loki. I couldn't find any trace log messages emitted when the actual sending is happening. A PR against loki-client-go should be submitted to add it.

You probably don't see anything on localhost:3100 because FLP exits before loki-client-go has sent the flowlogs to Loki.
As a quick and dirty hack, You may increase the waiting time to 10 seconds.

time.Sleep(time.Second)

A more proper solution would be to make FLP wait for all in-processing stuff to be finished before exiting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants