001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: LogConstants.java,v 1.16 2008/09/18 22:56:31 veiming Exp $
026 *
027 */
028
029/**
030 * Portions Copyrighted 2011 ForgeRock AS
031 */
032package com.sun.identity.log;
033
034import java.util.logging.Level;
035
036/**
037 * Defines constants used in the Logging service. <tt> LogConstants </TT>
038 * helps in maintaining a central repository of all the constants used in the
039 * package.
040 * @supported.api
041 */
042public class LogConstants {
043    /**
044     * Attribute defining the maximum (flat) file size, above which
045     * the files are either archived or rotated.
046     * @supported.api
047     */
048    public static final String MAX_FILE_SIZE =
049        "iplanet-am-logging-max-file-size";
050    /**
051     * Attribute defining the location where the logs go.
052     * @supported.api
053     */
054    public static final String LOG_LOCATION = "iplanet-am-logging-location";
055    /**
056     * Constant for the default base directory "prefix"
057     * for Flat File logging, indicating that the instance's
058     * Configuration directory + server URI should be used.
059     */
060    public static final String DEF_FF_LOG_LOC_BASE = "CONFIG_DIR_SERVER_URI";
061    /**
062     * Attribute defining whether the logs to be stored in
063     * flat-files or to a Database.
064     * @supported.api
065     */
066    public static final String BACKEND = "iplanet-am-logging-type";
067    /**
068     * Attribute defining the user name of the database (for
069     * authenticating to the Database)
070     */
071    public static final String DB_USER  = "iplanet-am-logging-db-user";
072    /**
073     * Attribute defining the password for the user of the db
074     * (for authenticating to DB)
075     */
076    public static final String DB_PASSWORD = "iplanet-am-logging-db-password";
077    /**
078     * Attribute defining the Database Driver.
079     * @supported.api
080     */
081    public static final String DB_DRIVER = "iplanet-am-logging-db-driver";
082    /**
083     * Attribute defining the currently present list of logs in the Directory.
084     */
085    public static final String LOG_LIST = "iplanet-am-logging-log-list";
086    /**
087     * Attribute defining the set of all fields being logged. These fields are
088     * predefined to be time, Date, LoginID, Domain, LogLevel, Data, IPAddr,
089     * and HostName.
090     * @supported.api
091     */
092    public static final String ALL_FIELDS = "iplanet-am-logging-allfields";
093    /**
094     * Attribute defining the fields currently selected by the administrator
095     * to be logged.
096     * @supported.api
097     */
098    public static final String LOG_FIELDS = "iplanet-am-logging-logfields";
099    /**
100     * Attribute defining the FileHandler class
101     */
102    public static final String FILE_HANDLER =
103        "iplanet-am-logging-file-handler";
104    /**
105     * Attribute defining the Database Handler class
106     */
107    public static final String DB_HANDLER = "iplanet-am-logging-jdbc-handler";
108    /**
109     * Attribute defining the number of history files a (flat file)
110     * log should have.
111     * @supported.api
112     */
113    public static final String NUM_HISTORY_FILES =
114        "iplanet-am-logging-num-hist-file";
115    /**
116     * Attribute defining the RemoteHandler class
117     */
118    public static final String REMOTE_HANDLER =
119        "iplanet-am-logging-remote-handler";
120    /**
121     * Default value for remote handler class
122     */
123   public static final String DEFAULT_REMOTE_HANDER =
124       "com.sun.identity.log.handlers.RemoteHandler";
125
126    /**
127     * Attribute defining the ELFFormatter class.
128     * (OpenSSO ELF Formatting. Hence FHandler
129     * should be associated with a ELFFormatter).
130     */
131    public static final String ELF_FORMATTER =
132        "iplanet-am-logging-elf-formatter";
133
134    /**
135     * Attribute defining the RemoteFormatter class which creates a
136     * xml string for a log action and sends it across to the remote
137     * OpenSSO.
138     */
139    public static final String REMOTE_FORMATTER =
140        "iplanet-am-logging-remote-formatter";
141    /**
142     * Default value for remote formatter class
143     */
144    public static final String DEFAULT_REMOTE_FORMATTER =
145        "com.sun.identity.log.handlers.RemoteFormatter";
146    /**
147     * Attribute defining the DBFormatter class
148     */
149    public static final String DB_FORMATTER =
150        "iplanet-am-logging-db-formatter";
151    /**
152     * Attribute defining the Authorization class used to see if a particular
153     * user is authorized to perform a particular task.
154     */
155    public static final String AUTHZ = "iplanet-am-logging-authz-class";
156    /**
157     * Attribute defining the Token Class used to generate a Token internally
158     * for use within the logging components.
159     */
160    public static final String TOKEN_PROVIDER =
161        "iplanet-am-logging-token-class";
162    /**
163     * Attribute defining the Archiver class
164     *
165     */
166    public static final String ARCHIVER = "iplanet-am-logging-archiver-class";
167    /**
168     * Platform attribute defining the locale
169     */
170    public static final String LOCALE =
171    "iplanet-am-platform-locale";
172    /**
173     * Naming attribute defining the logging service url.
174     */
175    public static final String LOGGING_SERVICE_URL =
176    "iplanet-am-naming-logging-url";
177    /**
178     * Defines CarriageReturn/LineFeed characters.
179     * @supported.api
180     */
181    public static final String CRLF = "\r\n";
182    /**
183     * Defines the LoggingService name.
184     * @supported.api
185     */
186    public static final String LOGGING_SERVICE = "Logging";
187    /**
188     * Defines the LoggingService name.
189     */
190    public static final String MAC_FIELDNAME = "MAC";
191    /**
192     * Defines the LoggingService name.
193     */
194    public static final String SIGNATURE_FIELDNAME = "Signature";
195    /**
196     * Defines the secure LoggingService log verify period.
197     */
198    public static final String LOGVERIFY_PERIODINSECONDS =
199        "iplanet-am-logging-verify-period-in-seconds";
200    
201    public static final long LOGVERIFY_PERIODINSECONDS_DEFAULT = 3600;
202
203    /**
204     * Defines the LogSign period in seconds.
205     */
206    public static final String LOGSIGN_PERIODINSECONDS         =
207        "iplanet-am-logging-signature-period-in-seconds";
208    
209    public static final long LOGSIGN_PERIODINSECONDS_DEFAULT = 600;
210    
211    /**
212     * Attribute defining the Log Security status; ON or OFF.
213     */
214    public static final String SECURITY_STATUS =
215        "iplanet-am-logging-security-status";
216    
217    /**
218     * Defines the File Read Handler class.
219     */
220    public static final String FILE_READ_HANDLER =
221        "iplanet-am-logging-file-read-handler";
222    /**
223     * Defines the Secure File Handler class.
224     */
225    public static final String SECURE_FILE_HANDLER =
226        "iplanet-am-logging-secure-file-handler";
227    /**
228     * Defines the Secure ELF Formatter class.
229     */
230    public static final String SECURE_ELF_FORMATTER =
231        "iplanet-am-logging-secure-elf-formatter";
232    /**
233     * Defines the DB Read Handler class.
234     */
235    public static final String DB_READ_HANDLER =
236        "sun-am-logging-db-read-handler";
237    
238    /**
239     * Attribute defining the maximum records for flat file logs.
240     * Also the default number of maximum records to be read.
241     */
242    public static final String MAX_RECORDS = "iplanet-am-logging-max-records";
243
244    /**
245     * Default max records if none entered
246     */
247    public static final String MAX_RECORDS_DEFAULT = "500";
248    /**
249     * Default max records, int version
250     */
251    public static final int MAX_RECORDS_DEFAULT_INT = 500;
252
253    /**
254     * Attribute defining the number of files per keystore after which
255     * the keystore should be reinitialized.
256     */
257    public static final String FILES_PER_KEYSTORE =
258        "iplanet-am-logging-files-per-keystore";
259
260    /**
261     * Attribute defining the Class that implements what the
262     * Verifier does when verification fails
263     */
264    public static final String VERIFIER_ACTION_CLASS =
265        "iplanet-am-logging-verifier-action-class";
266
267    /**
268     * Attribute defining the Directory where the logger certificate 
269     * store is stored.
270     */
271    public static final String LOGGER_CERT_STORE =
272        "iplanet-am-logging-secure-certificate-store";
273
274    /**
275     * Attribute defining the Class that implements the custom
276     * debug method in the case of log failure.
277     * @supported.api
278     */
279    public static final String DEBUG_IMPL_CLASS =
280    "iplanet-am-logging-debug-class";
281    /**
282     * Logging property prefix.
283     */
284    public static final String LOG_PROP_PREFIX =
285    "iplanet-am-logging";
286    /**
287     * Attribute defining the Buffer size.
288     * @supported.api
289     */
290    public static final String BUFFER_SIZE = "iplanet-am-logging-buffer-size";
291    /**
292     * Attribute defining the Maximum LogRecords held in memory if
293     * DB logging fails.
294     * @supported.api
295     */
296    public static final String DB_MEM_MAX_RECS =
297        "sun-am-logging-db-max-in-mem";
298    /**
299     * Attribute defining the Buffering time.
300     * @supported.api
301     */
302    public static final String BUFFER_TIME =
303        "iplanet-am-logging-buffer-time-in-seconds";
304    public static final long BUFFER_TIME_DEFAULT = 3600;
305    /**
306     * Attribute defining the Time Buffering Status; ON or OFF.
307     * @supported.api
308     */
309    public static final String TIME_BUFFERING_STATUS =
310        "iplanet-am-logging-time-buffering-status";
311    /**
312     * Attribute defining the Filter Class Name
313     */
314    public static final String FILTER_CLASS_NAME =
315        "iplanet-am-logging-filter-class-name";
316    
317    /**
318     * Attribute defining the Secure Timestamp generator class
319     */
320    public static final String SECURE_TIMESTAMP_GENERATOR =
321        "iplanet-am-logging-secure-timestamp-generator";
322    
323    /**
324     * Attribute defining the secure log helper class
325     */
326    public static final String SECURE_LOG_HELPER =
327        "iplanet-am-logging-secure-log-helper-class-name";
328    
329    /**
330     * Attribute defining the default secure log helper class
331     */
332    public static final String SECURE_DEFAULT_LOG_HELPER =
333        "com.sun.identity.log.secure.SecureLogHelperJSSImpl";
334
335    /**
336     * Attribute defining the security initializer class name
337     */
338    public static final String SECURITY_INITIALIZER =
339        "iplanet-am-logging-security-initializer-class-name";
340    
341    /**
342     * Attribute defining the security signing algorithm
343     */
344    public static final String SECURITY_SIGNING_ALGORITHM =
345        "iplanet-am-logging-secure-signing-algorithm";
346    
347    /**
348     * Attribute defining the default security signing algorithm
349     */
350    public static final String DEFAULT_SECURITY_SIGNING_ALGORITHM =
351        "SHA1withRSA";
352    
353    /**
354     * Attribute defining the log file logging level
355     */
356    public static final String LOGGING_LEVEL = "sun-am-log-level";
357    
358    /**
359     * Attribute defining the Oracle DB data type for the DATA field
360     */
361    public static final String ORA_DBDATA_FIELDTYPE =
362        "sun-am-logging-oradbdata-fieldtype";
363
364    /**
365     * Attribute defining the MySQL DB data type for the DATA field
366     */
367    public static final String MYSQL_DBDATA_FIELDTYPE =
368        "sun-am-logging-mysqldbdata-fieldtype";
369
370    /**
371     * Attribute defining the format for the Oracle DATE/TIME field
372     */
373    public static final String ORA_DBDATETIME_FORMAT =
374        "sun-am-logging-ora-dbdate-format";
375
376    /**
377     * Attribute defining the format for the MySQL DATE/TIME field
378     */
379    public static final String MYSQL_DBDATETIME_FORMAT =
380        "sun-am-logging-mysql-dbdate-format";
381    
382    /**
383     * Property defining whether logging is enabled
384     * @supported.api
385     */
386    public static final String LOG_STATUS =
387        "com.iplanet.am.logstatus";
388
389    /**
390     * Property defining Logging subdirectory.
391     */
392    public static final String LOG_LOCATION_SUBDIR =
393        "com.sun.identity.log.logSubdir";
394
395    public static final String LOG_READ = "READ";
396    
397    public static final String LOG_WRITE = "WRITE";
398    
399    public static final String LOG_CREATE = "CREATE";
400    
401    public static final String LOG_DELETE  = "DELETE";
402    
403    /*
404     *logInfoMap keys
405     */
406
407    /**
408     * The Date/Time field. This field is one of the two required in
409     * any log record.
410     * @supported.api
411     */
412    public static final String TIME = "TIME";
413    /**
414     * The Data field. This field is one of the two required in
415     * any log record.
416     * @supported.api
417     */
418    public static final String DATA = "Data";
419    /**
420     * The LogLevel field. The level at which the log record was
421     * logged.
422     * @supported.api
423     */
424    public static final String LOG_LEVEL = "LogLevel";
425    /**
426     * The Domain field. The AM Domain pertaining to the log record's
427     * Data field.
428     * @supported.api
429     */
430    public static final String DOMAIN = "Domain";
431    /**
432     * The LoginID field. The AM Login ID pertaining to the log record's
433     * Data field.
434     * @supported.api
435     */
436    public static final String LOGIN_ID = "LoginID";
437    /**
438     * The IPAddr field. The IP Address pertaining to the log record's
439     * Data field.
440     * @supported.api
441     */
442    public static final String IP_ADDR = "IPAddr";
443    /**
444     * The HostName field. The HostName pertaining to the log record's
445     * Data field.
446     * @supported.api
447     */
448    public static final String HOST_NAME = "HostName";
449    /**
450     * The ModuleName field. The AM Module pertaining to the log record's
451     * Data field.
452     * @supported.api
453     */
454    public static final String MODULE_NAME = "ModuleName";
455    /**
456     * The LoggedBy field. The ID associated with who logged the record.
457     * @supported.api
458     */
459    public static final String LOGGED_BY = "LoggedBy";
460    /**
461     * The ContextID field. The ID associated with the user's session
462     * that is the subject of this log record.
463     * @supported.api
464     */
465    public static final String CONTEXT_ID = "ContextID";
466    /**
467     * The NoSession field. Whether the authentication request was made with the noSession query parameter
468     * and that no permanent session was created when the authentication was successful.
469     */
470    public static final String NO_SESSION = "NoSession";
471    /**
472     * The MessageID field. The unique Message Identifier associated with
473     * this particular log record data field.
474     * @supported.api
475     */
476    public static final String MESSAGE_ID = "MessageID";
477
478    /**
479     * The NameID field. The Name Identifier associated with
480     * this particular log record data field.
481     * @supported.api
482     */
483    public static final String NAME_ID = "NameID";
484
485    /**
486     * The maximum number of fields in a "regular" record.
487     * Includes Time, Data, LogLevel, Domain, LoginID, IPAddr,
488     * HostName, ModuleName, LoggedBy, ContextID, MessageID, NameID.
489     * Be sure to increment if more fields are added.
490     * @supported.api
491     */
492    public static final int MAX_FIELDS = 12;
493
494    public static final String LOGIN_ID_SID = "LoginIDSid";
495    public static final String LOGGED_BY_SID = "LoggedBySid";
496
497    public static final String DEFAULT_AGENT_FILE = "amAuthLog";
498    public static final String POLICY_ACCESS = "amPolicy.access";
499    public static final String CONSOLE_ACCESS = "amConsole.access";
500    public static final String AUTHENTICATION_ACCESS =
501        "amAuthentication.access";
502    public static final String AUTHENTICATION_ERROR =
503        "amAuthentication.error";
504    public static final String PASSWORDRESET_ACCESS =
505        "amPasswordReset.access";
506    public static final String SSO_ACCESS = "amSSO.access";
507    public static final String ADMIN_ACCESS = "amAdmin.access";
508    public static final String ADMIN_ERROR = "amAdmin.error";
509    public static final String [] LOGFILENAMES = {
510        DEFAULT_AGENT_FILE,
511        POLICY_ACCESS,
512        CONSOLE_ACCESS,
513        AUTHENTICATION_ACCESS,
514        AUTHENTICATION_ERROR,
515        PASSWORDRESET_ACCESS,
516        SSO_ACCESS,
517        ADMIN_ACCESS,
518        ADMIN_ERROR };
519
520    public static final int NUM_RECORDS = 0;
521    public static final int NUM_BYTES = 1;
522
523    /**
524     * Key name for enable/disable Hostname resolution
525     */
526    public static final String LOG_RESOLVE_HOSTNAME =
527        "com.sun.identity.log.resolveHostName";
528
529    /**
530     * Attribute name for enable/disable Hostname resolution
531     */
532    public static final String LOG_RESOLVE_HOSTNAME_ATTR =
533        "resolveHostName";
534
535    /**
536     * Attribute name for logging status
537     */
538    public static final String LOG_STATUS_ATTR =
539        "logstatus";
540
541    /**
542     * the "Not Available" String for when a field is not provided
543     */
544    public static final String NOTAVAIL = "Not Available";
545
546    /**
547     * default logging level
548     */
549    public static final String DEFAULT_LOGGING_LEVEL_STR = "INFO"; 
550    public static final Level DEFAULT_LOGGING_LEVEL = Level.INFO;
551
552    /**
553     * logging start due to container starting
554     */
555    public static final String START_LOG_NEW_LOGGER_NAME =
556        "LOG_START_NEW_LOGGER";
557    /**
558     * logging ending due to container terminating
559     */
560    public static final String END_LOG_NAME = "LOG_END";
561    /**
562     * logging start due to logging configuration change
563     */
564    public static final String START_LOG_CONFIG_NAME = "LOG_START_CONFIG";
565    /**
566     * logging termination due to logging configuration change
567     */
568    public static final String END_LOG_CONFIG_NAME = "LOG_END_CONFIG";
569
570    /**
571     * System properties which specifies the log directory.
572     */
573    public static final String SYS_PROP_LOG_DIR = "com.sun.identity.log.dir";
574    /**
575     * Attribute defining the prefix for the logfiles
576     */
577    public static final String LOGFILE_PREFIX = "openam-logging-file-prefix";
578    /**
579     * Attribute defining the suffix for the logfiles. This should be a valid
580     * dateformat string.
581     */
582    public static final String LOGFILE_SUFFIX = "openam-logging-file-suffix";
583    /**
584     * Attribute defining the rotation interval in minutes.
585     */
586    public static final String LOGFILE_ROTATION = "openam-logging-file-rotation";
587}