def log_list(ctx, **kwargs): """Lists the available log files for a node, specify node id with --node""" ctx.init_args(**kwargs) node_name = get_node_name(ctx, ctx.node) r = ctx.framework_request('get', 'explore/clusters/' + ctx.cluster + '/nodes/' + node_name + '/log/files', headers={'Accept': '*/*'}) if r.status_code != 200: click.echo('Failed to get log files, status_code: ' + str(r.status_code)) else: click.echo(r.text)
def log_tail(ctx, log_file, lines, **kwargs): """Shows tail of log file for a node, specify node id with --node, filename with --file, and number of lines with --lines""" ctx.init_args(**kwargs) node_name = get_node_name(ctx, ctx.node) r = ctx.framework_request('get', 'explore/clusters/' + ctx.cluster + '/nodes/' + node_name + '/log/files/' + log_file + '?rows=' + str(lines), headers={'Accept': '*/*'}) if r.status_code != 200: click.echo('Failed to get log files, status_code: ' + str(r.status_code)) else: click.echo(r.text)
def node_log_list(args, cfg): service_url = cfg.scheduler_url() if service_url is False: raise CliError("Riak Mesos Framework is not running.") if args['node'] == '': raise CliError('Node name must be specified') node_name = util.get_node_name(cfg, args['cluster'], args['debug_flag'], args['node']) r = requests.get(service_url + 'explore/clusters/' + args['cluster'] + '/nodes/' + node_name + '/log/files') util.debug_request(args['debug_flag'], r) if r.status_code != 200: print('Failed to get log files, status_code: ' + str(r.status_code)) else: print(r.text) return