Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loggly adapter #1

Open
rosskukulinski opened this issue Mar 5, 2015 · 4 comments
Open

Add loggly adapter #1

rosskukulinski opened this issue Mar 5, 2015 · 4 comments

Comments

@rosskukulinski
Copy link

I'd like to take a crack at adding a loggly adapter.

@randomvariable
Copy link

Alternatively, what's the license for this project? Can it be forked to include the Loggly adapter?

@jaroslavl1
Copy link

When I evalulated loggly, I used this snippet in CoreOS with systemd:

[Unit]
Description=Loggly Forwarder

[Service]
Restart=always
RestartSec=10s

ExecStartPre=/bin/sh -c \
             "if [ -n \"$(etcdctl get /loggly.com/`hostname`/lastlog)\" ]; then  \
                echo \"Last log date: $(etcdctl get /loggly.com/`hostname`/lastlog)\"; \
              else \
                etcdctl set /loggly.com/`hostname`/lastlog\"`date +\"%Y-%%m-%d %%H:%M:%S\"`\"; true; \
              fi"
ExecStart=/bin/sh -c "journalctl --since \"$(etcdctl get /loggly.com/`hostname`/lastlog)\" -o short -f | awk '{ print \"\<34\>1\", $0; fflush(); }' | awk '{ print $0, \"[YOURKEYHERE@41058 tag='deis']\" }' | ncat --ssl logs-01.loggly.com 6514"
ExecStopPost=/bin/sh -c "export D=\"`date +\"%Y-%%m-%%d %%H:%M:%S\"`\"; \
                         /bin/etcdctl set /loggly.com/$(hostname)/lastlog \"$D\""

[Install]
WantedBy=multi-user.target

[X-Fleet]
Global=true

In non CoreOS linux you would have to replace the etcd call and store the date time somewhere else (file).

@randomvariable
Copy link

Hi.

I ended up writing this:
https://github.com/randomvariable/journald-forwarder

Tries to export as much structured data to Loggly as possible.

@josh-padnick
Copy link

Just a head's up that journald actually has a 2,048 character limit by default (https://bugs.freedesktop.org/show_bug.cgi?id=86465). Even when you output logs in JSON, entries that span more than 2048 characters will be auto-truncated.

For this reason, we ultimately wound up installing fluentd as a container, mounting the docker logs volume in read-only mode, and writing a custom fluentd plugin (which we hope to publish at some point) to add the appropriate metadata to the docker logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants