8
votes

In previous versions of AEM, certainly in CQ 5.6 and AEM 6.0, it was possible to tail the error logs over HTTP, without connecting to the server over SSH.

For example, I could get the last 1000 lines from the error log of my AEM author instance by calling:

http://localhost:4502/bin/crxde/logs?tail=1000

This seems to no longer be possible in AEM 6.2, this path does not resolve to anything.

Is there another way I could still tail the log over HTTP?

5

5 Answers

14
votes

A colleague answered this question for me on a chat so I'm putting it here to make it easier to find in the future.

There's now a neat utility in the OSGi console that allows one to view the logs as well as configure the various loggers. You can find it at http://localhost:4502/system/console/slinglog

Adobe Experience Manager Web Console Log Support

The Appender tab provides links to the various log files that can be used to load logs over HTTP.

Here's an example request it makes:

http://localhost:4502/system/console/slinglog/tailer.txt?tail=1000&name=%2Flogs%2Ferror.log

As you can see, both the log file name and the tail parameter can be specified. You can also use grep with both simple phrases and regular expressions.

This is a built-in feature of Apache Sling.

5
votes

In addition FYI, you can also find the status-slinglogs where you can perform log file downloads in a zip and logger actions in a txt to your local at /system/console/status-slinglogs

http://localhost:4502/system/console/status-slinglogs

enter image description here

and the direct urls for the downloading these zip files are as below http://localhost:4502/system/console/status-slinglogs.zip

http://localhost:4502/system/console/status-slinglogs/configuration-status-20170126-183246.zip (where as 20170126-183246 is and time stamp)

2
votes

You should not be looking at log files via CRXDE lite.

log files in 6.2 are project specific - better to open them from a text editor.

see attached screenshot.

Hope this helps!

Regards,

Prince

enter image description here

1
votes

I recently wrote a tool named "Log Tailer Plus" to solve exactly this problem. It's entirely free/open source - Take a look at a post describing usage here : https://blogs.perficientdigital.com/2019/05/14/introducing-aem-logtailerplus/

TLDR; You can grab an AEM package from here ( https://github.com/prftryan/LogTailerPlus ) install it to your machine, and access via http://localhost:4502/log-tailer-plus (if local) or http://server:port/log-tailer-plus

This tool will allow you to follow any number of logs at once by leveraging the out of the box logging endpoint(/system/console/tailer ) as well as dynamically checking active OSGI Logging Logger configurations. Currently, highlighting is supported, but only for relatively standard logging patterns (it's done via regex).

This is a new release, works on AEM 6.2+. Enjoy

0
votes

You can curl the log with e.g.:

curl -u admin:admin 'http://localhost:4502/system/console/slinglog/tailer.txt?tail=4000&name=%2Flogs%2Ferror.log'

where 4000 is the number of lines you want to get.