Accessing AEM 6.2 error logs over HTTP
Asked Answered
M

5

9

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?

Monied answered 26/1, 2017 at 18:16 Comment(0)
M
15

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.

Monied answered 26/1, 2017 at 18:16 Comment(0)
H
6

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)

Hackman answered 26/1, 2017 at 18:47 Comment(0)
K
2

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

Krak answered 1/2, 2017 at 5:35 Comment(2)
While this is a good advice but sometimes mostly due to system permissions, accessing the file system is not possible. For example, you may be an admin on the AEM instance but may not have login/permissions on the server itself so OP's original question for HTTP access is pretty much for a different use caseDeleterious
Thanks for your answer. I do realise viewing logs over HTTP is not the typical case but just like @i.net said, sometimes it's just not possible to access the files. Being able to view the logs over HTTP has saved me a lot of time and trouble a number of times.Monied
C
1

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.

Cortisol answered 24/4, 2019 at 10:53 Comment(0)
C
1

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

Cavit answered 15/5, 2019 at 1:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.