$ grep "ERROR" app.log
2026-02-09T14:23:10 [ERROR] render_timeout app=3dmaker
$ wc -l access.log
300 access.log
$ _

Log Analysis: Reading the Server's Story

Learn to read and analyze real server log files

1

What Are Log Files?

Every web server keeps a detailed diary. Every page visit, every error, every login — all recorded in log files. Think of them as the server's security camera footage.

The Server's Diary

Log files record everything that happens on a server. When someone visits a page, it's logged. When an error occurs, it's logged. When you save a project, it's logged.

Why Logs Matter

System administrators use logs to find bugs, track suspicious activity, measure performance, and understand how people use the system.

Where They Live

On Linux servers, logs live in /var/log/. This is a standard convention that every sysadmin knows by heart.

Anatomy of a Log Line

Click each part of this Apache access log entry to learn what it means:

10.42.8.15 - pixel [09/Feb/2026:14:23:01 +0000] " GET /create?app=beatmaker HTTP/1.1" 200 3847 "..." "Mozilla/5.0..."
Click any colored part above to learn what it means

HTTP Status Codes

200 OK
404 Not Found
500 Server Error
Fun Fact
A busy website like Google generates petabytes of logs every day. That's why log analysis tools are some of the most important software in the world!
2

Meet the Log Formats

Our server has three different log files, each serving a different purpose. Click each one to explore its format.

access.log

Apache Combined format — every HTTP request
10.42.8.15 - pixel [09/Feb/2026:14:23:01 +0000]
"GET /create?app=beatmaker HTTP/1.1" 200 3847
"https://mytekos.com/dashboard" "Mozilla/5.0..."
IP User Time Method Path Status Size

error.log

Apache/PHP errors — warnings and crashes
[Sun Feb 09 14:23:01.234567 2026]
[php:warn] [pid 1234] [client 10.42.8.15:54321]
PHP Warning: Undefined variable $project
in /src/Controllers/ProjectController.php on line 142
Time Module PID Client Message

app.log

Application events — saves, logins, errors
2026-02-09T14:23:01.234Z [INFO ]
user=pixel action=project_save
app=beatmaker project="My Song" xp=10
Time Level User Action Details
Pro Tip
Notice the log levels: INFO for normal events, WARN for potential problems, and ERROR for things that broke. Filtering by level is one of the first things a sysadmin does.
3

Navigate to the Logs

On every Linux server, log files live in /var/log/. Let's navigate there and see what we find.

Try These Commands

Use the terminal below to navigate to the log directory:

cd /var/log ls -l pwd
mytekOS Terminal

/var/log/ Convention

On every Linux and Unix system, /var/log/ is where log files are stored. The /var/ directory holds "variable data" — things that change while the system runs.

Read-Only

Log files are owned by root and are read-only for regular users. You can read them, but you can't modify or delete them.

4

Peek with head and tail

Log files can be huge. Instead of reading the whole file, use head to see the beginning and tail to see the end (most recent entries).

head [-n N] <file>
Show the first N lines of a file (default: 10)
Examples
$ head access.log # First 10 lines
$ head -n 5 error.log # First 5 lines
tail [-n N] <file>
Show the last N lines — the most recent entries!
Examples
$ tail app.log # Last 10 lines (newest)
$ tail -n 20 error.log # Last 20 errors

Try It Below!

Navigate to /var/log first, then try these commands:

cd /var/log head access.log tail -n 5 error.log tail -n 20 app.log
mytekOS Terminal
Pro Tip
On real servers, sysadmins use tail -f to watch logs in real-time — new lines appear as they're written. It's like watching the server think!
5

Search with grep

grep is the most powerful log analysis tool. It searches for patterns and shows only matching lines — like a search engine for files.

grep [options] <pattern> <file>
Search for lines containing a pattern
Options
-i # Case insensitive (ERROR = error = Error)
-n # Show line numbers
-c # Count matches instead of showing them

Search the Logs!

Make sure you're in /var/log, then try these searches:

grep "404" access.log grep -i "error" error.log grep -c "200" access.log grep -n "POST" access.log grep "ERROR" app.log
mytekOS Terminal

Challenge

How many requests returned a 404 error? Use grep -c "404" access.log to find out. Then try grep -c "500" access.log — which error type is more common?

6

Find YOUR Activity

Here's the cool part: these logs contain your real activity mixed in with simulated server traffic. Can you find yourself?

Your Username

Search the app.log for your username to find records of your saves, logins, and other activity. The more you've used the platform, the more entries you'll find!

Find Yourself in the Logs!

Search for your username in the application log:

grep "your_username" app.log grep "your_username" access.log grep -c "your_username" app.log
mytekOS Terminal

Challenge

How many of the 300 lines in app.log are yours? Use grep -c to count your entries, then wc -l app.log to see the total. What percentage of the traffic is you?

7

Measure with wc

wc (word count) measures files — how many lines, words, and bytes. Combined with other commands, it tells you the scale of your data.

wc [-lwc] <file>
Count lines, words, and bytes in a file
Options
wc file.log # Show all three counts
wc -l file.log # Lines only
wc -w file.log # Words only
wc -c file.log # Bytes only

Measure the Logs!

Make sure you're in /var/log, then measure:

wc access.log wc -l error.log wc -l app.log
mytekOS Terminal

Final Challenge

Which log file is the largest? Use wc -c on each file to compare their sizes in bytes. Can you explain why one is bigger than the others?

Keep Learning!
You now have the core skills for log analysis: head, tail, grep, and wc. Real sysadmins combine these with pipes (|) and tools like sort, uniq, and awk for even more powerful analysis!

Log Detective!

You can now read real server logs, search for patterns with grep, and measure data with wc. These are the exact same skills sysadmins use to debug production servers!

0
Formats Learned
0
Commands Tried
0
Time Exploring

Logs Tell the Story

Every server request, error, and event is recorded in log files for later analysis.

grep Finds the Needle

Search thousands of lines instantly with grep — filter by status codes, usernames, or errors.

head/tail Show the Edges

Peek at the beginning or end of a file without loading the whole thing.

wc Measures the Data

Count lines, words, and bytes to understand the scale of your data.

Status Codes Matter

200 means success, 404 means not found, 500 means server error — these codes tell the story.

Your Activity is Logged

Every action you take on a server leaves a trace in the logs.

Ready to Create?

Put your new knowledge into practice!

Suggest a Correction