Closed stephenWebComm closed 2 weeks ago
I think you need to provide more details on what you did. You're using a container, did you mount the logs into it?
You're also using the debug container so can shell in and check.
Yes i using two containers(demo application, fluentbit), and mount log file path in both containers
how can i using debug container check, Where can I find documents for reference?
Thank you for your response, but unfortunately, I am unable to use that method.
I am using gcp Cloud Run deploy, and Cloud run is a fully managed service and does not allow exec into the container.
below is my test config
Sample app setting
Sample app dockerfile
FROM ubuntu:latest
# Install Python 3
RUN apt-get update && \
apt-get install -y python3 && \
rm -rf /var/lib/apt/lists/*
# Expose port 8080
EXPOSE 8080
# Create a directory for the file
RUN mkdir -p /usr/src/app
RUN mkdir -p /logs
# Copy your script into the container
COPY entrypoint.sh /usr/src/app/
# Set the working directory
WORKDIR /usr/src/app
# Make the script executable
RUN chmod +x entrypoint.sh
# Run the entrypoint script
CMD ["./entrypoint.sh"]
Sample app entrypoint.sh
#!/bin/bash
# Start a simple Python HTTP server on port 8080 and log requests to a file
python3 -u -m http.server 8080 2> /logs/access.log
Sample app build and push to gcp project
docker build -t gcr.io/{project}/demo-app:v1
docker push gcr.io/{project}/demo-app:v1
fluentbit setting
fluentbit dockerfile
FROM fluent/fluent-bit:2.2.0-debug
RUN mkdir -p /logs
COPY fluent-bit.conf /fluent-bit/etc/fluent-bit.conf
fluentbit conf
[Service]
log_level trace
flush 10
[INPUT]
Name tail
Tag samplapp
Path /logs/*.log
Refresh_Interval 90
Read_from_Head true
[OUTPUT]
Name stdout
Match samplapp
fluentbit build and push to gcp project
docker build -t gcr.io/{project}/fluentbit-test:v1
docker push gcr.io/{project}/fluentbit-test:v1
gcp cloud run yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: demo-log
labels:
cloud.googleapis.com/location: asia-east1
annotations:
run.googleapis.com/launch-stage: BETA
run.googleapis.com/ingress: internal
run.googleapis.com/ingress-status: internal
run.googleapis.com/minScale: '1'
run.googleapis.com/max-surge: '0'
spec:
template:
spec:
containers:
- name: demo-1
image: gcr.io/{project}/demo-app:v1
ports:
- name: http1
containerPort: 8080
resources:
limits:
cpu: 1000m
memory: 512Mi
volumeMounts:
- name: in-memory-1
mountPath: /logs
- name: demo-2
image: gcr.io/{project}/fluentbit-test:v1
resources:
limits:
cpu: 1000m
memory: 512Mi
volumeMounts:
- name: in-memory-1
mountPath: /logs
volumes:
- name: in-memory-1
emptyDir:
medium: Memory
sizeLimit: 128Mi
gcp cloud run deploy service
gcloud run services replace gcloud-demo.yaml
and log will appear
2024-05-03 11:08:53.922 HKT
[2024/05/03 03:08:53] [error] [/src/fluent-bit/plugins/in_tail/tail_file.c:1620 errno=2] No such file or directory
2024-05-03 11:08:53.922 HKT
[2024/05/03 03:08:53] [error] [/src/fluent-bit/plugins/in_tail/tail_file.c:1694 errno=2] No such file or directory
2024-05-03 11:08:53.922 HKT
[2024/05/03 03:08:53] [error] [/src/fluent-bit/plugins/in_tail/tail_file.c:1009 errno=2] No such file or directory
2024-05-03 11:08:53.922 HKT
[2024/05/03 03:08:53] [debug] [input:tail:tail.0] scan_blog add(): dismissed: /logs/access.log, inode 2
2024-05-03 11:08:53.922 HKT
[2024/05/03 03:08:53] [debug] [input:tail:tail.0] 0 new files found on path '/logs/*.log'
Is there any other information I need to provide about this issue, or are there any updates?
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale
label.
This issue was closed because it has been stalled for 5 days with no activity.
Bug Report
Describe the bug
using tail input plugin setting bellow [INPUT] Name tail Tag samplapp Path /logs/*.log Refresh_Interval 90 Parser json_log_parser db /logs/test.db Read_from_Head true
but not collect expected log file fluentbit log:
2024-04-23 10:59:02.956 HKT [2024/04/23 02:59:02] [debug] [input:tail:tail.0] flb_tail_fs_inotify_init() initializing inotify tail input 2024-04-23 10:59:02.956 HKT [2024/04/23 02:59:02] [debug] [input:tail:tail.0] inotify watch fd=28 2024-04-23 10:59:02.956 HKT [2024/04/23 02:59:02] [debug] [input:tail:tail.0] scanning path /logs/.log 2024-04-23 10:59:02.957 HKT [2024/04/23 02:59:02] [error] [/src/fluent-bit/plugins/in_tail/tail_file.c:1620 errno=2] No such file or directory 2024-04-23 10:59:02.957 HKT [2024/04/23 02:59:02] [error] [/src/fluent-bit/plugins/in_tail/tail_file.c:1694 errno=2] No such file or directory 2024-04-23 10:59:02.957 HKT [2024/04/23 02:59:02] [error] [/src/fluent-bit/plugins/in_tail/tail_file.c:1009 errno=2] No such file or directory 2024-04-23 10:59:02.957 HKT [2024/04/23 02:59:02] [debug] [input:tail:tail.0] scan_blog add(): dismissed: /logs/app.log, inode 2 2024-04-23 10:59:02.957 HKT [2024/04/23 02:59:02] [debug] [input:tail:tail.0] 0 new files found on path '/logs/.log'
how can i get more debug info about error reason
To Reproduce
Expected behavior
can collect /log/app.log
Screenshots
Your Environment
Additional context