@@ -70,9 +70,9 @@ def init():
70
70
dest = 'inproxy' ,
71
71
type = str ,
72
72
default = (os .environ .get ('ULS_INPUT_PROXY' ) or None ),
73
- help = argparse . SUPPRESS )
74
- # We're surpressing this for now, as the param does not seem to work (mschiess-20210818 - see EME-498 )
75
- #help="Use a proxy Server for the INPUT requests (fetching data from AKAMAI API'S)")
73
+ help = "Use a proxy Server for the INPUT requests (fetching data from AKAMAI API'S)" )
74
+ #help=argparse.SUPPRESS )
75
+
76
76
# RAWCMD
77
77
input_group .add_argument ('--rawcmd' ,
78
78
action = 'store' ,
@@ -94,6 +94,21 @@ def init():
94
94
default = (os .environ .get ('ULS_SECTION' ) or 'default' ),
95
95
help = "Credentials file Section's name to use ('default' if not specified)." )
96
96
97
+ # Log Starttime
98
+ input_group .add_argument ('--starttime' ,
99
+ action = 'store' ,
100
+ type = int ,
101
+ dest = "starttime" ,
102
+ default = (os .environ .get ('ULS_STARTTIME' ) or None ),
103
+ help = "Start time (EPOCH SECONDS) from when to start getting logs ('default': cli_default (now), example: '1631556101')" )
104
+ # Log Endtime
105
+ input_group .add_argument ('--endtime' ,
106
+ action = 'store' ,
107
+ type = int ,
108
+ dest = "endtime" ,
109
+ default = (os .environ .get ('ULS_ENDTIME' ) or None ),
110
+ help = "End time (EPOCH SECONDS) until when to stop getting logs ('default': cli_default (never), example: '1631556101')" )
111
+
97
112
# ----------------------
98
113
# Output GROUP
99
114
output_group = parser .add_argument_group (title = "Output" ,
@@ -107,44 +122,39 @@ def init():
107
122
choices = uls_config .output_choices ,
108
123
help = "Select the Output Destination Default: None" )
109
124
110
- # Output HOST
125
+ # TCP / UPD
126
+ ## Output HOST
111
127
output_group .add_argument ('--host' ,
112
128
action = 'store' ,
113
129
type = str ,
114
130
default = (os .environ .get ('ULS_OUTPUT_HOST' ) or None ),
115
131
help = "Host for TCP/UDP" )
116
132
117
- # OUTPUT PORT
133
+ ## OUTPUT PORT
118
134
output_group .add_argument ('--port' ,
119
135
action = 'store' ,
120
136
type = int ,
121
137
default = int (os .environ .get ('ULS_OUTPUT_PORT' ) or '0' ),
122
138
help = "Port for TCP/UDP" )
123
139
124
- # Output FILTER
125
- output_group .add_argument ('--filter' ,
126
- action = 'store' ,
127
- type = str ,
128
- default = (os .environ .get ('ULS_OUTPUT_FILTER' ) or None ),
129
- help = "Filter (regex) to reduce number of sent log files (Only send lines that match the --filter argument)." )
130
-
131
- # HTTP URL
140
+ # HTTP
141
+ ## HTTP URL
132
142
output_group .add_argument ('--httpurl' ,
133
143
action = 'store' ,
134
144
type = str ,
135
145
default = (os .environ .get ('ULS_HTTP_URL' ) or None ),
136
146
help = f'Full http(s) target url i.e. '
137
147
f'https://my.splunk.host:9091/services/collector/event"' )
138
148
139
- # HTTP AUTH HEADER
149
+ ## HTTP AUTH HEADER
140
150
output_group .add_argument ('--httpauthheader' ,
141
151
action = 'store' ,
142
152
type = str ,
143
153
default = (os .environ .get ('ULS_HTTP_AUTH_HEADER' ) or None ),
144
154
help = 'HTTP Header for authorization. Example: '
145
155
'\' {"Authorization": "Splunk xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx"}\' ' )
146
156
147
- # Disable HTTP TLS verification
157
+ ## Disable HTTP TLS verification
148
158
output_group .add_argument ('--httpinsecure' ,
149
159
action = 'store' ,
150
160
type = bool ,
@@ -153,14 +163,98 @@ def init():
153
163
const = True ,
154
164
help = f'Disable TLS CA Certificate verification. Default: False' )
155
165
156
- # HTTP FORMAT DEFINITION
166
+ ## HTTP FORMAT DEFINITION
157
167
output_group .add_argument ('--httpformat' ,
158
168
action = 'store' ,
159
169
type = str ,
160
170
default = (os .environ .get ('ULS_HTTP_FORMAT' ) or '{"event": %s}' ),
161
171
help = 'HTTP Message format expected by http receiver '
162
172
'(%%s defines the data string). Default \' {\" event\" : %%s}\' ' )
163
173
174
+ # FILE STUFF
175
+ ## File Handler
176
+ output_group .add_argument ('--filehandler' ,
177
+ action = 'store' ,
178
+ type = str .upper ,
179
+ default = (os .environ .get ('ULS_FILE_HANDLER' ) or None ),
180
+ choices = uls_config .output_file_handler_choices ,
181
+ help = f"Output file handler - Decides when files are rotated -"
182
+ f"Choices: { uls_config .output_file_handler_choices } -"
183
+ f" Default: None" )
184
+ ## File Name
185
+ output_group .add_argument ('--filename' ,
186
+ action = 'store' ,
187
+ type = str ,
188
+ default = (os .environ .get ('ULS_FILE_NAME' ) or
189
+ uls_config .output_file_default_name ),
190
+ help = f"Output file destination (path + filename)"
191
+ f" Default: { uls_config .output_file_default_name } " )
192
+
193
+ ## File Backup count
194
+ output_group .add_argument ('--filebackupcount' ,
195
+ action = 'store' ,
196
+ type = int ,
197
+ default = (os .environ .get ('ULS_FILE_BACKUPCOUNT' ) or
198
+ uls_config .output_file_default_backup_count ),
199
+ help = f"Number of rotated files to keep (backup)"
200
+ f" Default: { uls_config .output_file_default_backup_count } " )
201
+
202
+ ## File Max bytes
203
+ output_group .add_argument ('--filemaxbytes' ,
204
+ action = 'store' ,
205
+ type = int ,
206
+ default = (os .environ .get ('ULS_FILE_MAXBYTES' ) or
207
+ uls_config .output_file_default_maxbytes ),
208
+ help = f"Number of rotated files to keep (backup)"
209
+ f" Default: { uls_config .output_file_default_maxbytes } bytes" )
210
+
211
+ ## File Time
212
+ output_group .add_argument ('--filetime' ,
213
+ action = 'store' ,
214
+ type = str .upper ,
215
+ default = (os .environ .get ('ULS_FILE_TIME' ) or
216
+ uls_config .output_file_time_default ),
217
+ choices = uls_config .output_file_time_choices ,
218
+ help = f"Specifies the file rotation trigger unit "
219
+ f" Default: { uls_config .output_file_time_default } , Valid Choices: { uls_config .output_file_time_choices } " )
220
+
221
+ ## File Time Interval
222
+ output_group .add_argument ('--fileinterval' ,
223
+ action = 'store' ,
224
+ type = int ,
225
+ default = (os .environ .get ('ULS_FILE_INTERVAL' ) or
226
+ uls_config .output_file_time_interval ),
227
+ help = f"Specifies the file rotation interval based on `--filetime` unit value"
228
+ f" Default: { uls_config .output_file_time_interval } " )
229
+
230
+ # ----------------------
231
+ special_group = parser .add_argument_group (title = "Transformation" ,
232
+ description = "Define Module Settings (Output manipulation)" )
233
+
234
+ # Output FILTER
235
+ special_group .add_argument ('--filter' ,
236
+ action = 'store' ,
237
+ type = str ,
238
+ default = (os .environ .get ('ULS_OUTPUT_FILTER' ) or None ),
239
+ help = "Filter (regex) to reduce number of sent log files (Only send lines that match the --filter argument)." )
240
+
241
+ # Transformation Handler
242
+ special_group .add_argument ('--transformation' ,
243
+ action = 'store' ,
244
+ dest = "transformation" ,
245
+ type = str .upper ,
246
+ default = (os .environ .get ('ULS_TRANSFORMATION' ) or None ),
247
+ choices = uls_config .transformation_choices ,
248
+ help = "Select a transformation to manipulate the output format (optional)" )
249
+
250
+ special_group .add_argument ('--transformpattern' , '--transformationpattern' ,
251
+ action = 'store' ,
252
+ dest = "transformationpattern" ,
253
+ type = str ,
254
+ default = (os .environ .get ('ULS_TRANSFORMATION_PATTERN' ) or None ),
255
+ help = "Provide a pattern to transform the output (Required for JMESPATH)" )
256
+
164
257
return parser .parse_args ()
165
258
259
+
166
260
# EOF
0 commit comments