I'm trying to figure out how to forward log data from my Websphere Liberty application that's running on EKS. The application writes various logs—info, error, and debug—into .log files within the container itself. We've set up Fluent Bit as a daemon set to collect logs, and while I can see logs using "kubectl logs -n ", I'm looking to send the logs from those .log files directly to CloudWatch instead. There are about 40 applications involved, and each one stores logs in different paths within their respective containers. Any advice on how to achieve this?
3 Answers
Fluent Bit runs on the nodes outside the application containers, so without a shared volume, it can't access the log files stored in the containers. To solve this issue, setting up a shared volume is crucial. You might want to check your setup and ensure that Fluent Bit has the right permissions to read from the desired paths within those log files.
One alternative approach is to run Fluent Bit as a sidecar within your application containers. This way, it can directly access the log files for forwarding. However, it's good to note that logging directly into files in a container isn't the best practice for long-term solutions. If possible, try to direct the logs to stdout or an OTEL endpoint instead.
Make sure you configure a shared volume in your deployment. Here's a quick example of how to do this. You'll need to mount the log directory to a hostPath so Fluent Bit can read the content. Here's a sample setup you might find helpful:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-logs
spec:
template:
spec:
containers:
- name: my-app
volumeMounts:
- name: logs
mountPath: /opt/myapp/logs
volumes:
- name: logs
hostPath:
path: /opt/myapp/logs
```
Also configure Fluent Bit to tail these logs and send them to CloudWatch.

Related Questions
How To Get Your Domain Unblocked From Facebook
How To Find A String In a Directory of Files Using Linux