Commit edf00ab3 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Set ~/.kamaki.log with mode 0600 as default

Refs: #3610
parent 969b0c8d
......@@ -121,7 +121,7 @@ The [global] group is treated by kamaki as a generic group for arbitrary options
* global.token <user authentication token>
* global.log_file <logfile full path>
set a custom location for kamaki logging. Default values are /var/log/kamaki.log, /var/log/kamaki/clients.log /tmp/kamaki.log and ./kamaki.log
set a custom location for kamaki logging. Default values are ~/.kamaki.log, /tmp/kamaki.log and ./kamaki.log (in that order)
* global.log_token <on|off>
allow kamaki to log user tokens
......@@ -177,7 +177,7 @@ Kamaki log file path is set by the following command::
By default, kamaki keeps a list of possible logfile locations::
/var/log/kamaki.log, /var/log/kamaki/clients.log, /tmp/kamaki.log, ./kamaki.log
~/.kamaki.log, /tmp/kamaki.log, ./kamaki.log
When initialized, kamaki attempts to open one of these locations for writing, in the order presented above and uses the first accessible for appending logs. If the log_file option is set, kamaki prepends the value of this option to the logfile list, so the custom location will be the first one kamaki will attetmpt to log at.
......@@ -58,13 +58,13 @@ DEFAULTS = {
'colors': 'off',
'account': '',
'token': '',
'log_file': os.path.expanduser('~/.kamaki.log'),
'log_token': 'off',
'log_data': 'off',
'max_threads': 7
'config': {
'cli': 'config',
'description': 'Configuration commands'
'history': {
'cli': 'history',
......@@ -31,14 +31,11 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
from os import chmod
import logging
LOG_FILE = ['kamaki.log', '/tmp/kamaki.log']
def get_log_filename():
......@@ -46,6 +43,7 @@ def get_log_filename():
with open(logfile, 'a+') as f:
chmod(logfile, 0600)
except IOError:
return logfile
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment