Skip to content

Commit

Permalink
Add LOGGLY_DEBUG variable to enable STDOUT logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vladgh committed Oct 1, 2015
1 parent 3b863f7 commit 9e3600a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Docker container for loggly (via rsyslog). Check out Loggly's [Docker logging do
Usage:

```
docker run -e LOGGLY_AUTH_TOKEN=[Loggly Customer Token] -e LOGGLY_TAG=[Tag Describing Source] sendgridlabs/loggly-docker
docker run -e LOGGLY_AUTH_TOKEN=[Loggly Customer Token] -e LOGGLY_TAG=[Tag Describing Source] LOGGLY_DEBUG=true sendgridlabs/loggly-docker
```

3 changes: 1 addition & 2 deletions rsyslog.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ $ModLoad omstdout.so # provide messages to stdout
# Loggly template format
$template LogglyFormat,"<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% [LOGGLY_AUTH_TOKEN@41058 tag=\"LOGGLY_TAG\"] %msg%\n"

# Send everything to stdout and Loggly
*.* :omstdout:
# Send everything to Loggly
*.* @@logs-01.loggly.com:514;LogglyFormat

# Setup disk assisted queues. An on-disk queue is created for this action.
Expand Down
7 changes: 6 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ fi
# Create spool directory
mkdir -p /var/spool/rsyslog

# If LOGGLY_DEBUG is true, write logs to stdout as well
if [ "$LOGGLY_DEBUG" = true ]; then
sed -i "/\*\.\* @@logs-01\.loggly\.com.*/a \*\.\* \:omstdout\:" /etc/rsyslog.conf
fi

# Expand multiple tags, in the format of tag1:tag2:tag3, into several tag arguments
LOGGLY_TAG=$(echo $LOGGLY_TAG | sed 's/:/\\\\" tag=\\\\"/g')
LOGGLY_TAG=$(echo "$LOGGLY_TAG" | sed 's/:/\\\\" tag=\\\\"/g')

# Replace variables
sed -i "s/LOGGLY_AUTH_TOKEN/$LOGGLY_AUTH_TOKEN/" /etc/rsyslog.conf
Expand Down

0 comments on commit 9e3600a

Please sign in to comment.