DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Cooking Up Engine Yard Logs with Chef

Cooking Up Engine Yard Logs with Chef

Trevor Parsons user avatar by
Trevor Parsons
·
Oct. 13, 12 · Interview
Like (0)
Save
Tweet
Share
6.78K Views

Join the DZone community and get the full member experience.

Join For Free

Opscode’s Chef is an open-source automation framework for the cloud, involving ‘recipes’ that can be triggered by events such as servers booting or restarting. Chef scripts are written in Ruby, but will often use OS-specific system calls to manipulate server instances. Chef is a great way to automate your cloud, and in particular its useful as your environment grows! On Engine Yard, Chef recipes can also be used to configure add-on’s (like Logentries) on your servers as we will explain…

Each server deployed in an Engine Yard environment uses the Linux-based Gentoo operating system, with Chef installed as standard. To make customisation of your application really simple, Engine Yard offers a RubyGem for hassle-free editing and uploading of Chef scripts. This, along with the wide variety of cookbooks offered for Engine Yard customers, means it is possible to automate a lot of otherwise complicated tasks without ever ‘SSHing’ into your instances. Because of this user-friendly interfacing and Engine Yard’s very open user access policy, using a log management service will not require lots of time and effort that could be better spent developing and testing your app.

Logging on Engine Yard
Engine Yard allows full access to the file system on each Gentoo Linux instance, either using Chef automation or via SSH. This includes a number of different log files in several different locations, but all of which can be sent to Logentries for analysis and error detection. Check out this previous blog post by my colleague Trevor Parsons, which gives an insight into what to look out for in Engine Yard logs. Some files that might be of interest are:

  • ~/yourapp-deploy.log: deployment related events for this instance
  • /var/log/engineyard/apps/yourapp/production.log: Rails application errors and events
  • /var/log/daemon.log: background daemon information
  • /db/mysql/{major_version}/log/ or db/mysql/log/: MySQL database logs
  • General Linux logs: as outlined here

The Logentries Cookbook
The Logentries cookbook installs and configures an agent to monitor log files and to send events to the Logentries service. This is performed automatically, with the user only required to edit one or two user specific variables in advance. The agent is packaged in a Gentoo Linux application, which is downloaded from the Logentries server, installed and started. A daemon process constantly monitors the files being followed for new events – don’t worry, it uses very little CPU. The Chef script also checks the daemon every time it is run, to make sure multiple processes are not started.

The cookbook is available for download from GitHub, and can be added to a larger set of cookbooks or used on its own. To start using Logentries with Engine Yard, simply set up a Logentries account and retrieve your user key from the Account page. You will need to add this to /cookbooks/le/attributes/recipe.rb in the indicated location. Some common files are followed by default -

  • “/var/log/syslog”
  • “/var/log/auth.log”
  • “/var/log/daemon.log”
  • “/var/log/nginx/#{app_name}.access.log”

- you can modify this list in cookbooks/le/recipes/configure.rb.

Then use the standard Engine Yard gem to upload the recipes to your instance – simply run

ey recipes upload -e ENVIRONMENT_NAME
ey recipes apply -e ENVIRONMENT_NAME

Adding additional files to your Logentries setup is very easy – just SSH into your Gentoo instance and use sudo le follow [file], or edit the recipes and re-upload if you prefer to avoid the command line. For more detailed instructions, see our Engine Yard docs.

Engine Chef (software)

Published at DZone with permission of Trevor Parsons, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • The 12 Biggest Android App Development Trends in 2023
  • Hidden Classes in Java 15
  • Remote Debugging Dangers and Pitfalls
  • How Observability Is Redefining Developer Roles

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: