Skip to content

Commit 2fe0d3c

Browse files
committed
debugging guide: add log format section
Signed-off-by: Wesley Pettit <[email protected]>
1 parent 85b8eac commit 2fe0d3c

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

troubleshooting/debugging.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Searching old issues](#searching-old-issues)
1717
- [Downgrading or upgrading your version](#downgrading-or-upgrading-your-version)
1818
- [Network Connection Issues](#network-connection-issues)
19+
- [What will the logs collected by Fluent Bit look like?](#what-will-the-logs-collected-by-fluent-bit-look-like)
1920
- [Memory Leaks or high memory usage](#memory-leaks-or-high-memory-usage)
2021
- [High Memory usage does not always mean there is a leak/bug](#high-memory-usage-does-not-always-mean-there-is-a-leakbug)
2122
- [FireLens OOMKill Prevention Guide](#firelens-oomkill-prevention-guide)
@@ -26,7 +27,7 @@
2627
- [Throttling, Log Duplication & Ordering](#throttling-log-duplication--ordering)
2728
- [Recommendations for throttling](#recommendations-for-throttling)
2829
- [Plugin Specific Issues](#plugin-specific-issues)
29-
- [rewrite_tag filter and cycles in the log pipeline](#rewritetag-filter-and-cycles-in-the-log-pipeline)
30+
- [rewrite_tag filter and cycles in the log pipeline](#rewrite_tag-filter-and-cycles-in-the-log-pipeline)
3031
- [Use Rubular site to test regex](#use-rubular-site-to-test-regex)
3132
- [Chunk_Size and Buffer_Size for large logs in TCP Input](#chunk_size-and-buffer_size-for-large-logs-in-tcp-input)
3233

@@ -248,6 +249,37 @@ Remember that we also have older Golang output plugins for AWS (no longer recomm
248249

249250
Consequently, the AWS team contributed an `auto_retry_requests` config option for each of the core AWS outputs. This will issue an immediate retry for any connection issues.
250251

252+
#### What will the logs collected by Fluent Bit look like?
253+
254+
This depends on what input the logs were collected with. However, in general, the raw log line for a container is encapsulated in a `log` key and a JSON is created like:
255+
256+
```
257+
{
258+
"log": "actual line from container here",
259+
}
260+
```
261+
262+
Fluent Bit internally stores JSON encoded as msgpack. Fluent Bit can only process/ingest logs as JSON/msgpack. With FireLens, your stdout & stderr logs would look like this with if you have not disabled `enable-ecs-log-metadata`:
263+
264+
```
265+
{
266+
"source": "stdout",
267+
"log": "116.82.105.169 - Homenick7462 197 [2018-11-27T21:53:38Z] \"HEAD /enable/relationships/cross-platform/partnerships\" 501 13886",
268+
"container_id": "e54cccfac2b87417f71877907f67879068420042828067ae0867e60a63529d35",
269+
"container_name": "/ecs-demo-6-container2-a4eafbb3d4c7f1e16e00"
270+
"ecs_cluster": "mycluster",
271+
"ecs_task_arn": "arn:aws:ecs:us-east-2:01234567891011:task/mycluster/3de392df-6bfa-470b-97ed-aa6f482cd7a6",
272+
"ecs_task_definition": "demo:7"
273+
"ec2_instance_id": "i-06bc83dbc2ac2fdf8"
274+
}
275+
```
276+
277+
The first 4 fields are added by the [Fluentd Docker Log Driver](https://docs.docker.com/config/containers/logging/fluentd/). The 4 ECS metadata fields are added by FireLens and are explained here:
278+
* [FireLens example generated config](https://github.com/aws-samples/amazon-ecs-firelens-under-the-hood/blob/mainline/generated-configs/fluent-bit/generated_by_firelens.conf)
279+
* [FireLens Under the Hood](https://aws.amazon.com/blogs/containers/under-the-hood-firelens-for-amazon-ecs-tasks/)
280+
281+
If you are using CloudWatch as your destination, there are additional considerations if you use the `log_key` option to just send the raw log line: [What if I just want the raw log line to appear in CW?](https://github.com/aws-samples/amazon-ecs-firelens-examples/tree/mainline/examples/fluent-bit/cloudwatchlogs#what-if-i-just-want-the-raw-log-line-from-the-container-to-appear-in-cloudwatch).
282+
251283
### Memory Leaks or high memory usage
252284

253285
#### High Memory usage does not always mean there is a leak/bug

0 commit comments

Comments
 (0)