toplisek

Well-Known Member
Jan 7, 2010
286
23
68
I like to get logs and how is actually the correct way to do this?
Example:

grep /var/log/apache2/access.log
grep /var/log/mysql/error.log
 

rpvw

Well-Known Member
Jul 18, 2013
1,100
475
113
UK
cPanel Access Level
Root Administrator
grep is a command-line utility for searching plain-text data sets for lines that match a regular expression.

There are hundreds of example and tutorial sites for grep if you use your favorite search engine :)

As an example, if I wanted to get all the lines in the /var/log/apache2/access_log that contained the string "mod.php?mod=downloads" , I could use a command like:
Code:
grep "mod.php?mod=downloads" /var/log/apache2/access_log
This would output in my terminal potentially many lines of code, so I might pipe the output to a file instead eg
Code:
grep "mod.php?mod=downloads" /var/log/apache2/access_log > myfile
then I can open or download myfile and deal with it at leisure :-D
 
Last edited:
  • Like
Reactions: cPanelMichael

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello,

Let us know if you have any questions after reviewing the previous post.

Thanks!