Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: third_party/gsutil/gslib/commands/getlogging.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2011 Google Inc.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 from gslib.command import Command
16 from gslib.command import COMMAND_NAME
17 from gslib.command import COMMAND_NAME_ALIASES
18 from gslib.command import CONFIG_REQUIRED
19 from gslib.command import FILE_URIS_OK
20 from gslib.command import MAX_ARGS
21 from gslib.command import MIN_ARGS
22 from gslib.command import PROVIDER_URIS_OK
23 from gslib.command import SUPPORTED_SUB_ARGS
24 from gslib.command import URIS_START_ARG
25 from gslib.help_provider import HELP_NAME
26 from gslib.help_provider import HELP_NAME_ALIASES
27 from gslib.help_provider import HELP_ONE_LINE_SUMMARY
28 from gslib.help_provider import HELP_TEXT
29 from gslib.help_provider import HelpType
30 from gslib.help_provider import HELP_TYPE
31
32 _detailed_help_text = ("""
33 <B>SYNOPSIS</B>
34 gsutil getlogging uri
35
36 <B>DESCRIPTION</B>
37 If logging is enabled for the specified bucket uri, the server responds
38 with a <Logging> XML element that looks something like this:
39
40 <?xml version="1.0" ?>
41 <Logging>
42 <LogBucket>
43 logs-bucket
44 </LogBucket>
45 <LogObjectPrefix>
46 my-logs-enabled-bucket
47 </LogObjectPrefix>
48 </Logging>
49
50 If logging is not enabled, an empty <Logging> element is returned.
51
52 You can download log data from your log bucket using the gsutil cp command.
53
54
55 <B>ACCESS LOG FIELDS</B>
56 Field Type Description
57 time_micros integer The time that the request was completed, in
58 microseconds since the Unix epoch.
59 c_ip string The IP address from which the request was made.
60 The "c" prefix indicates that this is information
61 about the client.
62 c_ip_type integer The type of IP in the c_ip field:
63 A value of 1 indicates an IPV4 address.
64 A value of 2 indicates an IPV6 address.
65 c_ip_region string Reserved for future use.
66 cs_method string The HTTP method of this request. The "cs" prefix
67 indicates that this information was sent from the
68 client to the server.
69 cs_uri string The URI of the request.
70 sc_status integer The HTTP status code the server sent in response.
71 The "sc" prefix indicates that this information
72 was sent from the server to the client.
73 cs_bytes integer The number of bytes sent in the request.
74 sc_bytes integer The number of bytes sent in the response.
75 time_taken_micros integer The time it took to serve the request in
76 microseconds.
77 cs_host string The host in the original request.
78 cs_referer string The HTTP referrer for the request.
79 cs_user_agent string The User-Agent of the request.
80 s_request_id string The request identifier.
81 cs_operation string The Google Cloud Storage operation e.g.
82 GET_Object.
83 cs_bucket string The bucket specified in the request. If this is a
84 list buckets request, this can be null.
85 cs_object string The object specified in this request. This can be
86 null.
87
88
89 <B>STORAGE DATA FIELDS</B>
90 Field Type Description
91 bucket string The name of the bucket.
92 storage_byte_hours integer Average size in bytes/per hour of that bucket.
93 """)
94
95
96 class GetLoggingCommand(Command):
97 """Implementation of gsutil getlogging command."""
98
99 # Command specification (processed by parent class).
100 command_spec = {
101 # Name of command.
102 COMMAND_NAME : 'getlogging',
103 # List of command name aliases.
104 COMMAND_NAME_ALIASES : [],
105 # Min number of args required by this command.
106 MIN_ARGS : 1,
107 # Max number of args required by this command, or NO_MAX.
108 MAX_ARGS : 1,
109 # Getopt-style string specifying acceptable sub args.
110 SUPPORTED_SUB_ARGS : '',
111 # True if file URIs acceptable for this command.
112 FILE_URIS_OK : False,
113 # True if provider-only URIs acceptable for this command.
114 PROVIDER_URIS_OK : False,
115 # Index in args of first URI arg.
116 URIS_START_ARG : 0,
117 # True if must configure gsutil before running command.
118 CONFIG_REQUIRED : True,
119 }
120 help_spec = {
121 # Name of command or auxiliary help info for which this help applies.
122 HELP_NAME : 'getlogging',
123 # List of help name aliases.
124 HELP_NAME_ALIASES : [],
125 # Type of help:
126 HELP_TYPE : HelpType.COMMAND_HELP,
127 # One line summary of this help.
128 HELP_ONE_LINE_SUMMARY : 'Get logging XML for a bucket',
129 # The full help text.
130 HELP_TEXT : _detailed_help_text,
131 }
132
133 # Command entry point.
134 def RunCommand(self):
135 self.GetXmlSubresource('logging', self.args[0])
OLDNEW
« no previous file with comments | « third_party/gsutil/gslib/commands/getdefacl.py ('k') | third_party/gsutil/gslib/commands/help.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698