Zeroska
  • 🐱Zeroska - The Bold
  • Computer/Cyber Security
    • ⭐Fresh off the boat - for new Blue Teamer/ SOC Analyst
    • πŸ’€Necromancer (DFIR)
      • πŸ•΅οΈDFIR and DFIR case
        • πŸ—ƒοΈCase Files
          • Misconfiguration 0x01
      • πŸ“”My own DFIR notes
        • The Mark of The Web (MOTW)
        • LNK Shortcut
        • Prefetch, AmCache, ShimCache in Windows
        • Malicious Document (VBA, Office, PDF, ...)
        • SRUM (System Resource Usage Monitor)
        • Volatility notes
        • Understand Logon Session in Windows
        • "Very" Hidden sheets in Excel
        • Hidden Processes
      • πŸ“”Notes
        • Useful Resources
        • Useful Resources DFIR
        • Saved Content (Backup for the OG content get deleted)
          • How to be best SOC analyst ever
    • πŸ§™β€β™‚οΈDefense Witchcraft
      • Data Analysis as a Defender
      • Active Directory
      • Windows Event Logs
        • Authentication (Windows Account Life Cycle Events)
      • MS Exchange
      • Windows
    • πŸ’™My Current Blue Team Operation
      • VLAN Monitoring Template
      • Daily Monitoring Report
      • General Playbook
      • JupyterHub Configuration Guide
      • How to train your Blue Team
    • 🏭ICS/OT
      • Setup ICS/OT Simulation Learning Lab
      • Smart Grids
      • Learning Modbus TCP
      • Learning DNP3
      • Resources/Blogs/Links
    • πŸ₯·Threat Intelligence
      • Small Cyber Threat Intelligence Program
      • Intelligence Analysis [VN]
      • OSINT Information Monitoring
        • Telegram Info-Stealer Monitoring
      • C2 Tracker
      • Fake Website Tracker
      • Dark Web Investigation Attempt
      • Threat Intelligence Quick Win
      • Resources/Blogs/Links
  • πŸ˜’Computer and Technology
    • My Home Lab Setup
    • 🐴ELK Stack
      • Useful Resources
      • ELK Stack - Container - Docker Compose - AWS ECS
      • ECS - Elastic Common Schema
      • Elasticsearch
      • Logstash
      • Troubleshooting and Problems
    • 🐧Linux
      • Setting up good SSH Authentication
      • Configure Auditd and how to leverage it
      • ELF Format
      • Useful Links
    • πŸ“¦Containers
      • Docker container logs is quite big
      • Worth Reading
    • πŸͺ Splunk Learning Experience
      • Splunk Test Lab
      • Data Collection Tier (How to get the data)
      • SC4S Custom Filter For Windows Event Log in Syslog Format (NXLog)
      • Useful Resources
  • Threat Hunting
    • Hunting for Implant
    • Using STRIDE and DREAD
    • 🐳Predators and Preys (Computing)
      • Tracks or Hunting Artifacts
    • πŸ“¦Network Packet Analysis
      • The Basic
      • Tshark | Zeek Copy & Paste
      • Network Analysis Resources
    • Grep | Powershell Search | Regex
    • Hunting Resources
  • 🎡In my remains
    • Choices
    • The Art of Facing Unknown Problems
    • Build the best DFIR team
    • Reverse Engineering - Đồ Γ‘n hΖ°α»›ng ngΓ nh A "Hα»₯t" cα»§a tΓ΄i
Powered by GitBook
On this page
  • What is Docker Logs
  • Docker container log file is too big
  • Delete The Log File - Short Term Solution
  • Change Logging Driver for docker container - Better Solution or Docker Logging Best Practices
  • Docker Logging Driver
  • Links

Was this helpful?

  1. Computer and Technology
  2. Containers

Docker container logs is quite big

PreviousContainersNextWorth Reading

Last updated 2 years ago

Was this helpful?

What is Docker Logs

So like every good software, Docker store their container's logs on your disk, because my logstash container is outputing log like a tons (getting logs from 6 servers) so the logfile is the same size as the log I recieve -> 2GB of log is equal to 2GB docker's log

Docker container log file is too big

The log file of docker container is located at /var/lib/docker/containers/*/*-json.log (you must have root privilege in order to perform action on this file)

I run an ELK Stack for collecting logs from mutiple sources (currently there are 8 machine that send log to my ELK Stack with the average volume of 250 e/s) the estimate logs are 8GB/days, it doesn't seem so bad right?

The problem is logstash container generate a huge amount of logs (because some the)

Because the default logging driver and the amout of event logstash recieve from the server across our system

Delete The Log File - Short Term Solution

This is the easy way and not the good way to do this kind of problem, it is not going to permanent fixing the issue because the issue is not the log file is too big -> it is because you configure the Logging Driver the wrong way (so I think)

Command to check the largest file on /var

sudo du -ahx /var | sort -rh | head -10

Command to truncate the log file to zero, what truncate will do

truncate -s 0 $(docker inspect --format='{{.LogPath}}' <container_name_or_id>)

This solution isn't the best way but it is the fastest way, I would say

Change Logging Driver for docker container - Better Solution or Docker Logging Best Practices

"To update the logging driver for a container, the container has to be re-created with the desired options"

That is called log rotation guys, you need to have a policy for your log, compressed format,... below are some practices I found on the internet and consider it is the right way to do

Docker Logging Driver

When an application in a Docker container emits logs, they are sent to the application’s stdout and stderr output streams, docker logging driver can access this stream and send log to a file

Links

πŸ˜’
πŸ“¦
https://stackoverflow.com/questions/42510002/docker-how-to-clear-the-logs-properly-for-a-docker-container
https://www.datadoghq.com/blog/docker-logging/
162GB of log file sitting on a server which has the capacity of 350GB