Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chronos

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chronos

Log cronjob results to graylog2

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-58.82%
Maintainers
1
Weekly downloads
 
Created
Source

chronos

Install

After you got nodejs (which includes npm now), you can just:

`npm install -g chronos`

After this you may need to link node and chronos in your /bin or /usr/bin directory. Otherwise your cronjob may not be able to find them. To check, just create a cron like which node and look into your mailbox.

Configuration

chronos should be compatible with every service that supports AMQP. You can configure chronos by placing a JSON file in /etc/chronos.json or /usr/local/etc/chronos.json. Example:

{
	"mode" : "amqp",
	"amqp" : {
		"host" : "10.0.13.1",
		"port" : 5672,
		"login" : "guest",
		"password" : "guest",
		"vhost" : "/",
		"key" : "somekey"
	},
	"stage" : "production"
}

If you don't set one of those, the defaults apply. They mean that chronos will communicate with graylog2 directly, using a GELF service running locally on port 12201 (which is the default for a fresh install of graylog2).

{
	"mode" : "graylog2",
	"graylog2" : {
		"host" : "127.0.0.1",
		"port" : 12201
	},
	"amqp" : {
		"host" : "127.0.0.1",
		"port" : 5672,
		"login" : "guest",
		"password" : "guest",
		"vhost" : "/",
		"key" : "logging"
	},
	"stage" : false
}

Usage

Let's say your current crontab looks something like this:

0 * * * * date >> /var/log/cronjobs/myjob.log && php /var/www/myapp/cli/index.php --some=bar

If you just replace this by:

0 * * * * chronos -s mystage -j myjob 'php /var/www/myapp/cli/index.php --some=bar'

From now on chronos will log the results of your cronjobs to graylog2.

Options

The cli options of chronos are:

  • jobname: (-j, required) Name of the cronjob, any string will do.
  • stage: (-s) Define a stage, if none is given the one in /etc/chronos.json is added
  • stdout: (-o) Add stdout output to log
  • stderr: (-e) Add stderr output to log
  • env: (-v) Add all environment variables to the log

Examples

chronos -oj job1 'printf "This output will be added to the log"'

chronos -j job2 'printf "This will trigger an Error-level message"; exit 1;'

Keywords

FAQs

Package last updated on 15 Apr 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc