@cumulus/logger
A logging library for use on the Cumulus project.
The @cumulus/logger
library exports a Logger
class, which generates
JSON-formated log events.
Log events always have the following keys:
- level (string) - the priority level of the message
- message (string) - the message itself
- sender (string) - the resource that created the message
- timestamp (string) - an ISO-8601 timestamp
Log events may have the following options keys:
- executions (string)
- version (string)
Log events may also contain user-specified keys.
Example log event:
{
"level": "info",
"message": "hello world",
"sender": "greetingFunction",
"timestamp": "2018-10-19T19:12:47.501Z"
}
Install
$ npm install @cumulus/logger
Usage
const Logger = require('@cumulus/logger');
const log = new Logger({ sender: 'example' });
log.info('hello, world');
API
new Logger({ [sender], [executions], [version] })
sender
Type: string
The sender of the log event. Typically a Lambda Function Name or ECS Task Name.
Defaults to "unknown".
executions
Type: string
An optional description of the executions.
version
Type: string
An optional version.
log.debug([...messageArgs])
Writes a log event to stdout with level set to "debug".
args
Type: ...any
See console.log().
log.error([...messageArgs][, error])
Writes a log event to stderr with level set to "error".
args
Type: ...any
See console.log().
error
Type: Error
If the last argument is an Error then the following additional properties will be set on the log event:
- error (Object)
- name (string)
- message (string)
- stack (Array<string>) - the lines of the stack trace
log.fatal([...messageArgs])
Writes a log event to stdout with level set to "fatal".
args
Type: ...any
See console.log().
log.info([...messageArgs])
Writes a log event to stdout with level set to "info".
args
Type: ...any
See console.log().
log.infoWithAdditionalKeys(additionalKeys, ...messageArgs)
Writes a log event to stdout with level set to "info". In addition to the
standard keys, additional keys will be added to the event. If an additional key
is specified with the same name as a standard key, the value standard key will
be displayed.
additionalKeys
Type: Object
Additional key/value pairs to be added to the event.
args
Type: ...any
See console.log().
log.trace([...messageArgs])
Writes a log event to stdout with level set to "trace".
args
Type: ...any
See console.log().
log.warn([...messageArgs])
Writes a log event to stdout with level set to "debug".
args
Type: ...any
See console.log().
What is Cumulus?
Cumulus is a cloud-based data ingest, archive, distribution and management
prototype for NASA's future Earth science data streams.
Cumulus Documentation
Contributing
See Cumulus README
[v1.13.0] - 2019-5-20
PLEASE NOTE
CUMULUS-802 added some additional IAM permissions to support ECS autoscaling, so you will have to redeploy your IAM stack.
As a result of the changes for CUMULUS-1193, CUMULUS-1264, and CUMULUS-1310, you must delete your existing stacks (except IAM) before deploying this version of Cumulus.
If running Cumulus within a VPC and extended downtime is acceptable, we recommend doing this at the end of the day to allow AWS backend resources and network interfaces to be cleaned up overnight.
BREAKING CHANGES
-
CUMULUS-1228
- The default AMI used by ECS instances is now an NGAP-compliant AMI. This
will be a breaking change for non-NGAP deployments. If you do not deploy to
NGAP, you will need to find the AMI ID of the
most recent Amazon ECS-optimized AMI,
and set the
ecs.amiid
property in your config. Instructions for finding
the most recent NGAP AMI can be found using
these instructions.
-
CUMULUS-1310
- Database resources (DynamoDB, ElasticSearch) have been moved to an independent
db
stack.
Migrations for this version will need to be user-managed. (e.g. elasticsearch and dynamoDB).
Order of stack deployment is iam
-> db
-> app
. - All stacks can now be deployed using a single
config.yml
file, i.e.: kes cf deploy --kes-folder app --template node_modules/@cumulus/deployment/[iam|db|app] [...]
Backwards-compatible. For development, please re-run npm run bootstrap
to build new kes
overrides.
Deployment docs have been updated to show how to deploy a single-config Cumulus instance. params
have been moved: Nest params
fields under app
, db
or iam
to override all Parameters for a particular stack's cloudformation template. Backwards-compatible with multi-config setups.stackName
and stackNameNoDash
have been retired. Use prefix
and prefixNoDash
instead.- The
iams
section in app/config.yml
IAM roles has been deprecated as a user-facing parameter,
unless your IAM role ARNs do not match the convention shown in @cumulus/deployment/app/config.yml
- The
vpc.securityGroup
will need to be set with a pre-existing security group ID to use Cumulus in a VPC. Must allow inbound HTTP(S) (Port 443).
-
CUMULUS-1212
@cumulus/post-to-cmr
will now fail if any granules being processed are missing a metadata file. You can set the new config option skipMetaCheck
to true
to pass post-to-cmr without a metadata file.
-
CUMULUS-1232
@cumulus/sync-granule
will no longer silently pass if no checksum data is provided. It will use input
from the granule object to:
- Verify checksum if
checksumType
and checksumValue
are in the file record OR a checksum file is provided
(throws InvalidChecksum
on fail), else log warning that no checksum is available. - Then, verify synced S3 file size if
file.size
is in the file record (throws UnexpectedFileSize
on fail),
else log warning that no file size is available. - Pass the step.
-
CUMULUS-1264
- The Cloudformation templating and deployment configuration has been substantially refactored.
CumulusApiDefault
nested stack resource has been renamed to CumulusApiDistribution
CumulusApiV1
nested stack resource has been renamed to CumulusApiBackend
- The
urs: true
config option for when defining your lambdas (e.g. in lambdas.yml
) has been deprecated. There are two new options to replace it:
urs_redirect: 'token'
: This will expose a TOKEN_REDIRECT_ENDPOINT
environment variable to your lambda that references the /token
endpoint on the Cumulus backend APIurs_redirect: 'distribution'
: This will expose a DISTRIBUTION_REDIRECT_ENDPOINT
environment variable to your lambda that references the /redirect
endpoint on the Cumulus distribution API
-
CUMULUS-1193
- The elasticsearch instance is moved behind the VPC.
- Your account will need an Elasticsearch Service Linked role. This is a one-time setup for the account. You can follow the instructions to use the AWS console or AWS CLI here or use the following AWS CLI command:
aws iam create-service-linked-role --aws-service-name es.amazonaws.com
-
CUMULUS-802
- ECS
maxInstances
must be greater than minInstances
. If you use defaults, no change is required.
-
CUMULUS-1269
- Brought Cumulus data models in line with CNM JSON schema:
- Renamed file object
fileType
field to type
- Renamed file object
fileSize
field to size
- Renamed file object
checksumValue
field to checksum
where not already done. - Added
ancillary
and linkage
type support to file objects.
Added
Changed
Fixed