codec
codec

Reputation: 8796

Logging in chef recipes

As per chef documentation there is a log resource available

log 'message' do
  message 'A message add to the log.'
  level :info
end

But this jsut prints the logs on the console during a chef client run. Can we not put these logs in a file at some location eg: /var/logs/chef ? If yes how can we differentiate between logs from various client runs?

Upvotes: 0

Views: 371

Answers (1)

Draco Ater
Draco Ater

Reputation: 21206

The log message gets put into the same place where all the other messages are going. You can provide -L or --logfile flag to chef-client to make it write to file.

chef-client -L /var/log/chef/client.log

Upvotes: 2

Related Questions