-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Implement events logging feature #1256
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
Conversation
Record events (i.e. pluginhook's calls) as syslog entries and provide a shortcut command to display the last part of the log file. A brief summary of the changes follows: dokku: - New DOKKU_EVENTS_LOGFILE envvar to hold logfile location. plugins/20_events/commands: - events output log entries, a tail's follow-like mode is provided too. - events:[on|off] enables/disables logging. - events:list lists events that are logged. plugins/20_events/hook: - Generic hook that writes log entries. All the events are registered via symlink to this script. plugins/common/functions: - dokku_log_event() writes log entries via logger. - dokku_log_pluginhook_call() formats log entries and writes them via dokku_log_event().
It had gone lost while porting the original 3rd party plugin.
This should fix ShellCheck SC2046 error.
|
I have a few questions about this feature in general.
Can you include an excerpt from the logs to show what this looks like? |
plugins/20_events/commands
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do and why? Also can we have it output some sort of message if a user attempts dokku events and the plugin is not enabled?
Currently this happens
root@dokku:~/dokku# dokku plugins-install
root@dokku:~/dokku# dokku events
find: cannot search `': No such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact this happens on deployment as well
remote: find: cannot search `': No such file or directory
remote: find: cannot search `': No such file or directory
remote: find: cannot search `': No such file or directory
|
Just tested this. I don't see anything in I did run |
plugins/20_events/commands
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lint fails.
In ./plugins/20_events/commands line 31:
logged="$(find $(dirname $0) -type l -printf '%f ' | sort)"
^-- SC2046: Quote this to prevent word splitting.
|
(The discussion begun on IRC, so I'm mostly copying here what I said in #dokku) We experienced kernel hangs on containers removal and this has proven to be very helpful to understand which were the events that triggered the issue. To answer both questions, the rationale is to mitigate the lack of logging functionalities in dokku by providing a not too fine-grained view of what's going on behind the scenes. |
|
@michaelshobbs can you please check whether |
|
@alessio indeed |
|
@michaelshobbs run: ls -l /var/log/dokku.logPlease confirm that your result matches the following $ ls -l /var/log/dokku.log
-rw-rw-r-- 1 syslog dokku 171986 Jun 26 20:30 /var/log/dokku.logIt's crucial that the owner is sudo service rsyslog restart |
|
Restarting rsyslog seems to work. Can we add that to the install script? |
Seems that a mere reload doesn't work.
|
Done. |
|
Can you add logrotation for this? |
|
Definitely we can. I'll work on it. sent via mobile
|
As requested by @josegonzalez.
|
I was wondering whether it would be a good idea to create a /var/log/dokku/ sub-dir and redirect the plugin's logs to its own /var/log/dokku/events.log as we may want to log other things in the future. Comments are much welcome! |
|
@alessio looks like there's an issue with your test |
Parse output and check return code after running test commands with the 'run' utility.
|
@alessio since we're now log rotating, i think a |
|
Indeed it does |
Rename dokku.log to events.log. Refresh tests accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This question may be naive, but any reason we're doing a double negative here. More directly why not do this?
[[ "$DOKKU_EVENTS" ]] && dokku_log_pluginhook_call "$(basename $0)" "$@"
EDIT: This would also be consistent with plugins/20_events/install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Wed, Jul 1, 2015 at 6:50 PM, Michael Hobbs notifications@github.com wrote:
This question may be naive, but any reason we're doing a double negative here. More directly why not do this?
It's just my personal preference, but if that breaks the code style
I'm more than happy to fix it then.
Alessio Treglia | www.alessiotreglia.com
Debian Developer | alessio@debian.org
Ubuntu Core Developer | quadrispro@ubuntu.com
0416 0004 A827 6E40 BB98 90FB E8A4 8AE5 311D 765A
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, actually due set -e if $DOKKU_EVENTS is unset the hook would return 1, and that would break the plugins chain, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 😄
This is mostly for consistency with its own install script.
This reverts commit 54ed3c1.
|
I was wrong, you were right here. |
|
Done, it's all yours now! |
|
👍 |
Implement events logging feature
|
@alessio I hit you up on IRC but just in case, would you be willing to add some documentation around this? |
|
👍 sure, I will write some docs ASAP |
Record events (i.e. pluginhook's calls) as syslog entries and provide a shortcut command to display the last part of the log file.
A brief list of changes follows:
dokku:plugins/20_events/commands:plugins/20_events/hook:plugins/common/functions: