Please note that LinuxExchange will be shutting down on December 31st, 2016. Visit this thread for additional information and to provide feedback.

Is there a way to make a php script so that http://view_log.php wil display the content of a log file in /var/logs/something.log? Im running Apache and latest php....

asked 05 Mar '11, 12:17

ygdrazil's gravatar image

ygdrazil
111
accept rate: 0%




Is there a way to do this? Yes. Many ways.

The real question is: Why do you want to do this? then "How" to do it becomes the next question.

Do you want to do this because you're coding something custom? OR do you just need the end result (which is to see the log details / filter them) ?

If the second one, there are many existing programs and suites which already have this functionality to them, simply install one of them.

link

answered 08 Mar '11, 17:27

Ron's gravatar image

Ron ♦
9361718
accept rate: 13%

Well i have a documentation server and would like so see some logs on it by entering http://servernale/logname (would me nice to take latest file in dir also....

(11 Mar '11, 19:19) ygdrazil

You could use the back tick notation i.e. $contents = cat /var/log/yourlog;

// parse and format here echo $contents;

link

answered 06 Mar '11, 19:36

Adam%20Pullen's gravatar image

Adam Pullen
1
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×8

Asked: 05 Mar '11, 12:17

Seen: 5,752 times

Last updated: 22 Mar '11, 18:23

powered by OSQA