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

github-bot: redirect stdout to file #553

Closed
wants to merge 1 commit into from

Conversation

phillipj
Copy link
Member

Fixes an issue we have currently, where all current logs are deleted whenever the bot is redeployed because of two things:

  1. We have the github-bot repo cloned and write logs to a sub-directory of repo root (logs)
  2. Upon deploy git clean -fdx deletes any untracked files in the repo

Simply writing out bunyan logs to stdout would also simplify our current log related code in the bot.

Is logrotate the way to go for rotating this?

Allows us to simplify github-bot logging by not having to write into logs
into a file. Also fixes an issue we have currently, where all current logs
are deleted whenever the bot is redeployed.
@phillipj
Copy link
Member Author

Refs nodejs/github-bot#88 (comment)

@jbergstroem
Copy link
Member

jbergstroem commented Nov 23, 2016

Wouldn't stdout be collected by systemd (when deployed on debian8, ubuntu, etc) which is already managed by journalctl?

@phillipj
Copy link
Member Author

I'm all ears to better / simpler ways. I'd say it's important to be able to
expose this log over HTTP like we currently have. Using bunyan to filter
and trace logs as been really valuable so far.

On Wed, 23 Nov 2016 at 23:23, Johan Bergström notifications@github.com
wrote:

Wouldn't stdout be collected by systemd (when deployed on debian8, ubuntu,
etc) which is already managed by logctl?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#553 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABLLEyPU_hwJvKd1MBaCNCAX5D3iPy2qks5rBLzGgaJpZM4K7Es5
.

@jbergstroem
Copy link
Member

I'm personally not a "log over http" guy (grep, awk, tail, ..) but if has been a big part of the teams debugging lets opt for that then.

If you're going that route, look at systemd's StandardOutput= directive and pass that to file. Another alternative could be using console+syslog and use the system logger (with an identifier) to control output. That way, the system logger could probably handle rotating as well.

@jbergstroem
Copy link
Member

By the way, does stdout follow the same format bunyan expects?

@phillipj
Copy link
Member Author

By the way, does stdout follow the same format bunyan expects?

Yepp. Everything we log is through bunyan, which writes both to stdout and a log file ATM. When running locally via npm start the stdout output gets prettified for easier reading tho. That's not the case on the server, as the systemd service executes the server script directly.

@phillipj
Copy link
Member Author

On second thought, doing this seemed more complex than simply writing logs outside the directory where the github-bot repo is cloned into.

Refs #602

@phillipj
Copy link
Member Author

Closing this in favor of #602

@phillipj phillipj closed this Jan 30, 2017
@phillipj phillipj deleted the github-stdout-to-file branch January 30, 2017 20:45
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

Successfully merging this pull request may close these issues.

2 participants