Grep the Shop Logs

Linux lab Beginner 6 tasks 10 points

The online shop had a rough day. Its log is /var/log/shop/app.log and its settings are under /etc/shop. Use grep to answer the questions.

How it works: the terminal below is a real Linux machine running in your browser. Click it and type. Tasks tick themselves off as you complete them; questions are answered in the box under each task. Press Reset any time for a fresh machine. Your password on this machine (for sudo) is student.

student@vulntech:~ Starting…
Getting your Linux machine ready…
The first start downloads about 20 MB. After that your browser keeps it, and labs start in a moment.

Hints

Not sure a pattern is right? Run it without -c first and look at the lines.

Solution explanation

-c counts, -v turns the match around, -n shows line numbers and -A 1 shows the line after the match. -i catches both ERROR and error. -rl searches every file under a folder and prints only the file names.

Show solution
grep -c ERROR /var/log/shop/app.log
grep -vc INFO /var/log/shop/app.log
grep -n CRITICAL /var/log/shop/app.log
grep -A 1 CRITICAL /var/log/shop/app.log
grep -i error /var/log/shop/app.log > errors.txt
grep -rl api_key /etc/shop
HOME LEARN COMMUNITY DASHBOARD