Why is syslog's var.log So Huge?

Vincent Jul 15, 2026

Ever found yourself scratching your head, wondering why your Linux system's var/log/lastlog file has swollen to an unexpectedly large size? You're not alone. This file, which records every login attempt on your system, can grow significantly over time, especially on servers with high user activity.

a large pile of logs sitting on top of a lush green field
a large pile of logs sitting on top of a lush green field

But why does it get so large, and how can we manage its size? Let's delve into this issue, breaking down the reasons behind a bloated lastlog file and exploring practical solutions to keep it in check.

Lost and Found Log Template for MS Excel | Excel Templates
Lost and Found Log Template for MS Excel | Excel Templates

Understanding the Lastlog File

The lastlog file stores a wealth of information about user logins, including the full name, ID, login shell, and the timestamp of the last successful login. Each line in the file corresponds to a user account on your system, making it a comprehensive record of system activity.

Free Printable Sales Log Template
Free Printable Sales Log Template

In theory, this file should only grow when new users are added or existing users log in. However, several factors can cause it to grow excessively, pushing its size to several megabytes or even gigabytes over time.

Accumulated Login Records

a piece of paper with writing on it that says logaric properties involving 1
a piece of paper with writing on it that says logaric properties involving 1

The primary reason for a large lastlog file is the accumulation of login records. Each time a user logs in, a new record is added to the file. On systems with high user activity, these records can stack up quickly, especially if logins occur frequently.

Consider a server with hundreds of users, each logging in multiple times a day. Over weeks or months, these daily records can add up to a significant file size, especially when you factor in the space allocated for timestamps.

Low Disk Space Alert Fatigue

a close up of a tree trunk with rings on it
a close up of a tree trunk with rings on it

Another reason for a bloated lastlog file is the systems' threshold for sending low disk space alerts. Many systems are configured to only trigger these alerts when disk space drops below a certain percentage. If your threshold is set too high, the lastlog file might swell unnoticed until it hits that critical point.

In some cases, administrators turn off these alerts altogether, either due to alert fatigue or because they rely on other monitoring tools. Either way, the lastlog file can grow unchecked until it becomes a serious issue.

Managing the Lastlog File Size

Structured Logging in C#
Structured Logging in C#

Now that we understand why the lastlog file can grow so large, let's explore some strategies to keep its size under control.

Remember, we're not suggesting you delete this file entirely, as it contains valuable system activity data. Instead, we'll focus on managing its size effectively.

a large pile of logs sitting in the middle of a forest
a large pile of logs sitting in the middle of a forest
Daily Log Sheets Templates - 7 Free PDF Printables | Printablee
Daily Log Sheets Templates - 7 Free PDF Printables | Printablee
(20+) Facebook Forest, Tree Habitat Drawing, Soil, Geography
(20+) Facebook Forest, Tree Habitat Drawing, Soil, Geography
Logs 🪵
Logs 🪵
Algebra 2: Intro to Logarithms
Algebra 2: Intro to Logarithms
Trip Sheets - 10 Free PDF Printables | Printablee
Trip Sheets - 10 Free PDF Printables | Printablee
Make It Yourself: Best DIY Wood Log Projects
Make It Yourself: Best DIY Wood Log Projects
Printable Lost and Found Log Sheet Template
Printable Lost and Found Log Sheet Template
Document Log Templates | Free Log Templates
Document Log Templates | Free Log Templates
It's just a log.
It's just a log.
an arabic text on a dark background with a yellow smiley face in the middle and two words below it
an arabic text on a dark background with a yellow smiley face in the middle and two words below it
Logging stock image. Image of woods, stacked, trees, firewood - 1064655
Logging stock image. Image of woods, stacked, trees, firewood - 1064655
Log Rule Board Feet Calculator
Log Rule Board Feet Calculator
Sawing Logs To Build A Barn (on a tight budget) - The Flip Flop Barnyard
Sawing Logs To Build A Barn (on a tight budget) - The Flip Flop Barnyard
How Much is Your Log Worth?
How Much is Your Log Worth?
Do I Really Need to Log Out of Webapps?
Do I Really Need to Log Out of Webapps?
a log with flowers growing out of it
a log with flowers growing out of it
4 Column Sheet - 10 Free PDF Printables | Printablee
4 Column Sheet - 10 Free PDF Printables | Printablee
Inventory Log Templates | Free Log Templates
Inventory Log Templates | Free Log Templates
the fuel consumption log is shown in this image, it shows that there are many different types
the fuel consumption log is shown in this image, it shows that there are many different types

Regular Pruning

One straightforward approach is to regularly prune the lastlog file. You can achieve this by using the `lastlog` command with the `-c` flag, which clears the file and resets the login timestamps for all users.

For example, you might schedule a weekly cron job to run the command `sudo lastlog -c` to keep the file size in check. Of course, this will reset the login timestamps, but it's a trade-off that many system administrators find acceptable for managing disk space.

-limiting Record History

Instead of clearing the entire lastlog file, you can limit the history it keeps. The `logcheck` service allows you to configure the number of logins to keep for each user. By setting this value to a reasonable number, you can prevent the file from growing too large.

For instance, you can configure `logcheck` to only keep the most recent 50 logins for each user. With this setting, old login records will be automatically removed, keeping the file size manageable.

Monitoring Disk Space

Regularly monitoring your system's disk space usage can help you stay ahead of lastlog file growth. You can use tools like `df` or `nCDU` to track disk space usage, setting up alerts to notify you when the lastlog file (or any file) crosses a specified size threshold.

Early notifications give you time to investigate and address the issue before it becomes a critical problem. You might even discover other factors contributing to disk space usage, like overly large log files or filling up directory sizes.

In most cases, a combination of these strategies will help you effectively manage the size of the var/log/lastlog file. Regular pruning or limiting the login history, along with vigilant disk space monitoring, can help keep this file size in check, ensuring it remains a useful resource rather than a cause for concern.

Remember, the lastlog file serves a valuable purpose in system administration, providing valuable insights into user activity and login patterns. By proactively managing its size, you can ensure it remains a useful tool, helping you maintain a well-governed, high-performing system.