-
Run the otelcol using prepared config file
otelcol-contrib --config config.yaml
You should see the details of two log lines from logs.txt file that were ingested and processed:
... 2022-05-28T20:31:58.847+0200 INFO loggingexporter/logging_exporter.go:71 LogsExporter {"#logs": 2} 2022-05-28T20:31:58.850+0200 DEBUG loggingexporter/logging_exporter.go:81 ResourceLog #0 Resource SchemaURL: ... -
Read the File Exporter documentation
-
Change the configuration to export those logs into a JSON file
logs.jsonin a local directory and run otelcol againYou should now see that new
logs.jsonfile has been created -
Take a look at the JSON structure in
logs.jsonfile - thejqcommand might be helpful here:$ cat logs.json | jq { "resourceLogs": [ { "resource": {}, "scopeLogs": [ { "scope": {}, "logRecords": [ ...
You should be able to find
host,typeandfooattributes in there -
Run otelcol once again, the
logs.txtfile will be collected from beginning. What happened to thelogs.jsonfile? How to prevent that?
file
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||