示例#1
0
    def Run(self, args):
        filters = [args.log_filter] if args.IsSpecified('log_filter') else []
        filters.append('resource.labels.service_name = "%s"' % args.service)
        filters += read_logs_lib.MakeTimestampFilters(args)

        return common.FetchLogs(read_logs_lib.JoinFilters(filters),
                                order_by=args.order,
                                limit=args.limit)
示例#2
0
 def _Run(self, args):
     filter_clauses = read_logs_lib.MakeTimestampFilters(args)
     filter_clauses += [args.log_filter] if args.log_filter else []
     parent = util.GetParentFromArgs(args)
     if args.IsSpecified('location'):
         parent = util.CreateResourceName(
             util.CreateResourceName(
                 util.CreateResourceName(parent, 'locations',
                                         args.location), 'buckets',
                 args.bucket), 'views', args.view)
     return common.FetchLogs(
         read_logs_lib.JoinFilters(filter_clauses, operator='AND') or None,
         order_by=args.order,
         limit=args.limit,
         parent=parent)
示例#3
0
    def Run(self, args):
        filters = [args.log_filter] if args.IsSpecified('log_filter') else []
        filters.append('resource.type = %s \n' % 'cloud_run_revision')
        filters.append('resource.labels.service_name = %s \n' % args.service)
        filters.append('resource.labels.location = %s \n' %
                       flags.GetRegion(args, prompt=False))
        filters.append('severity >= DEFAULT')
        filters += read_logs_lib.MakeTimestampFilters(args)

        lines = []

        logs = common.FetchLogs(read_logs_lib.JoinFilters(filters),
                                order_by=args.order,
                                limit=args.limit)

        for log_line in logs:
            output_log = FormatLog(log_line)
            if output_log:
                lines.append(output_log)

        for line in reversed(lines):
            log.out.Print(line)