I use Debian stable and Apache 2.4.

In the past I wrote a script with 3 different commands to read all logs of my webserver. Like:


nginx -t && echo;echo;echo
tail /var/log/access.log && echo;echo;echo
tail /var/log/error.log

Right now for my personal websites I use Apache instead.

Is there an Ansible command to check all essential logs of a web server whether Apache/Nginx, or any other webserver with significant usage (statistically) ?

A total "server-environment" command can also be good (say, something that would include Postfix/Ssmtp as and so forth, as well).

  • I'm personally not aware of such a role/play, but you could just use those commands with the command module. I'd recommend writing the output to a local file on the respective server and then fetch that for viewing (the output of ansible is ... ummmm ... shall we say unsightly .... ) – tink Dec 23 '18 at 3:59
  • @tink: You should use to debug module to make Ansible Playbook output appear. That’s the exact advice Red Hat Support Engineers gave me in the topic. Not a big fan of it... but it works. – Peschke Dec 23 '18 at 6:09
  • 1
    Ansible is a configuration management tool, not a log monitoring tool. The fact that you’re using Ansible doesn’t prevent you from running your own small scripts such as this one (which doesn’t alter the system state). – Stephen Kitt Dec 23 '18 at 21:59
  • Perhaps you should take a look at something like goaccess.io. I think it's more appropriate to what you seem to want to do. – Mxx Dec 24 '18 at 4:14
  • @Mxx goaccess.io sure does seem like a serious log monitoring tool (I would say LMT), but will you say it is an overkill if I only desire small webserver debugging like in the script in the question? – JohnDoea Dec 24 '18 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.