Logscape – Monitoring Ansible.

gitToday I’m going to walk you through the steps to enable the monitoring of Ansible with Logscape 3, this may become a series of the steps taken to develop an Ansible app, but let’s start with the basics, configuring your Ansible installation to generate logs, and configuring Logscape to ingest those logs.

Configuring Ansible

Fortunately, configuring Ansible to generate logs is an easy task, navigate to your Ansible config, or if you don’t have one, create it. Ansible will look in

  • ansible.cfg in the working directory
  • ~/.ansible.cfg
  • /etc/ansible/ansible.cfg

For its config file, once found open it up, and you’ll want to add the following

[defaults]

log_path=/path/to/logfile

You can of course, choose to write your log file anywhere, just make sure it’s somewhere the account you’re running Logscape under has read permissions to!zn9xtsq

Run an Ansible command, and you should see data start to appear in your newly created log file. That’s the hard part done.


 

Configuring Logscape

I’m going to presume that your host already has a configured Logscape instance running on it, if it doesn’t you can download Logscape here, and read our getting started guide, here.

OuVoAxDLoad up your manager, and navigate to the data sources page.¬†We’re going to be creating a new datasource for our Ansible data. In my ansible.cfg I configured my logs to be output to /home/gomoz/ansiblelogs/ so that’s what I’ll be using as my directory. For the file mask, you’ll want whatever mask identifies your ansible log, my ansible log is named ansible.log, so I can just stick with the default *.log. Expiration, Archiving Rules and Host filter are all up to you, for the tag I choose ansible-build. Logscape is now tailing your ansible logs.HVxOju3
.

 

 

 

 


 

Searching your Data

Now that Ansible is configured to output to a log file, and Logscape is configured to index that log file, Logscape can be used to search for events within your logs.

hswhUU1

While we’re not doing anything interesting with the data (That’ll be in the next blog post). Logscape is now ingesting your Ansible Logs allowing you to bring to bear all of that analytic power to better understand what is happening in your builds. In the next blog we’ll set up some datatypes, and alerts for when things go wrong.

Thanks for reading.