Skip to content

Instantly share code, notes, and snippets.


Alex Trepca atrepca

View GitHub Profile
atrepca / kafka.service
Created Sep 27, 2016
Kafka Systemd Service Configuration File for Ubuntu 16.04
View kafka.service
Description=Apache Kafka server (broker)
atrepca /
Last active Aug 29, 2015
Create custom Puppet fact from AWS EC2 instance tags
# Requirements:
# * aws-cli:
# * IAM roles or aws access key and secret in place
INSTANCE_ID="$(/usr/bin/curl -s http://instance-data/latest/meta-data/instance-id)"
REGION="$(/usr/bin/curl -s http://instance-data/latest/meta-data/placement/availability-zone | /bin/sed -e 's/[a-z]$//')"
TAG_VALUE="$(/usr/local/bin/aws ec2 describe-tags --filters "Name=resource-id,Values=${INSTANCE_ID}" "Name=key,Values=${TAG_NAME}" --region ${REGION} --output=text | /usr/bin/cut -f5)"
echo "mytag_fact=${TAG_VALUE}"
# SOURCE: this is an adaptation of the following gists:
# * - original
# * - modification of the original /w pagination for more than 30 repos
# SCOPE: backup an organization's GitHub repositories with issues and wikis
# Uses the GitHub API to pull down the list of repos & clone them
atrepca / gist:7159195
Last active Jan 23, 2016
Send Heroku logs to an rsyslog server and save them to separate files by application
View gist:7159195
  • Add a Heroku drain for your app to forward the logs to your rsyslog server:

      heroku drains:add --app my-prod-app syslog://
  • List the drain you just created to get the unique Drain ID:

      heroku drains -x --app my-prod-app
  • On the rsyslog server save the logs coming from Heroku to separate files, without duplicating to /var/log/messages (thanks to the & ~). Create a /etc/rsyslog.d/90-heroku.conf file containing:

      if $HOSTNAME startswith 'Drain_ID' then /opt/log/heroku/my-prod-app.log
      & ~
You can’t perform that action at this time.