adobe / openwhisk-action-logger Goto Github PK
View Code? Open in Web Editor NEWLogger for openwhisk actions.
License: Apache License 2.0
Logger for openwhisk actions.
License: Apache License 2.0
When starting a debug session, I always see the following being logged in the Debug Console:
Trace: { params: { __CFBundleIdentifier: 'com.googlecode.iterm2' } } before
at .../node_modules/@adobe/openwhisk-action-logger/src/logger.js:270:9
at .../node_modules/@adobe/openwhisk-action-logger/src/logger.js:229:12
at .../node_modules/cls-hooked/context.js:118:13
at Namespace.run (.../node_modules/cls-hooked/context.js:97:5)
...
The environment variable __CFBundleIdentifier
seems to have appeared lately and contains the name of the terminal application being used (it reads __CFBundleIdentifier=com.apple.Terminal
when using macOS's default terminal).
It would be nice if the list of parameters being ignored in
openwhisk-action-logger/src/logger.js
Lines 257 to 264 in c983a43
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
.circleci/config.yml
circleci/node 14
.github/workflows/semantic-release.yaml
actions/checkout v3
actions/setup-node v3
.github/workflows/semver-check.yaml
package.json
@adobe/helix-log 6.0.0
cls-hooked ^4.2.2
@adobe/eslint-config-helix 1.3.2
@adobe/openwhisk-action-utils 4.4.8
@semantic-release/changelog 6.0.1
@semantic-release/git 10.0.1
codecov 3.8.3
eslint 8.25.0
eslint-plugin-header 3.1.1
eslint-plugin-import 2.26.0
ghooks 2.0.4
jsdoc-to-markdown 7.1.1
lint-staged 13.0.3
mocha 10.0.0
mocha-junit-reporter 2.1.0
nock 13.2.9
nyc 15.1.0
semantic-release 19.0.5
node >= 8.3.0
the local config support is not used anymore and should be removed.
The CoralogixLogger and the PapertrailLogger automatically add an ow
object to the log message:
ow: {
activationId: process.env.__OW_ACTIVATION_ID,
actionName: process.env.__OW_ACTION_NAME,
transactionId: process.env.__OW_TRANSACTION_ID
},
This is really useful and this information could be enhanced with a header
property containing the value of the incoming params.__ow_headers
.
This would be required to achieve: adobe/helix-home#70
Based on @tripodsan feedback, the full ow
object (+ the new headers
) should be computed directly in the generic helix-log logger. (details adobe/openwhisk-action-utils@63a5291#commitcomment-35805854)
I started to prototype this but I hit 2 road blockers:
__ow_logger
object contains a nested structure of 4 level of MultiLoggers. This should be fixed with adobe/openwhisk-action-utils#26sanitize
method to prevent the headers to contain secrets. See adobe/openwhisk-action-utils#27Consumers of the openwhisk-action-utils
API have to worry about what they log and sanitise their secret. This will either end-up into code duplication or secrets being exposed in the logs because they will forget.
For example: https://github.com/adobe/helix-dispatch/blob/master/src/index.js#L51-L58
This was supposed to be addressed by adobe/helix-log#44 but since I managed to output many secrets yesterday, I think this is not properly supported and at least for sure it is not tested.
I do not know if this should be in https://github.com/adobe/helix-log or in this project, I leave to our "log architects" (@koraa @tripodsan @trieloff) to decide what is the best location for this.
My only requirement is that when I log:
{
MY_SECRET_KEY: 'mykeyvalue'
}
log outputs is:
{
MY_SECRET_KEY: 'undisclosed secret'
}
The text does not matter but the key should not be removed so that I know it is there but I cannot read the value! If we remove the key (like here https://github.com/adobe/openwhisk-action-utils/blob/master/src/logger.js#L205), I do not know if the key was not transported to the action, if I forgot it in the service config or if I use a format which is filtered out for a param to not filter like MY_DEBUG_PARAM
.
Follow up of my researches for adobe/openwhisk-action-builder#106
I have been playing with the log levels and I found out multiple inconsistencies. I created:
which contains the same code, only difference is the LOG_LEVEL
set to the corresponding branch name.
Switching between those branches and redeploying the action leads to multiple inconsistencies:
I use the line rm -fr dist; npm run deploy >/dev/null 2>&1; curl https://adobeioruntime.net/api/v1/web/acapt/helix-services-private/[email protected]; sleep 7; wsk activation logs --last
to
Here is a full script:
# run debug version
$ git checkout debug
$ rm -fr dist; npm run deploy >/dev/null 2>&1; curl https://adobeioruntime.net/api/v1/web/acapt/helix-services-private/[email protected]; sleep 7; wsk activation logs --last
Done. LOG_LEVEL parameter: debug. Logger level: silly.
2020-01-31T10:03:27.068Z stderr: [ERROR] log.error
2020-01-31T10:03:27.068Z stderr: [WARN] log.warn
2020-01-31T10:03:27.069Z stderr: [INFO] log.info
2020-01-31T10:03:27.069Z stderr: [DEBUG] log.debug
# -> result as expected
# run trace version
$ git checkout trace
$ rm -fr dist; npm run deploy >/dev/null 2>&1; curl https://adobeioruntime.net/api/v1/web/acapt/helix-services-private/[email protected]; sleep 7; wsk activation logs --last
Done. LOG_LEVEL parameter: trace. Logger level: silly.
2020-01-31T10:04:22.149Z stderr: [TRACE] before { params: { __ow_headers: { accept: '*/*', connection: 'close', host: 'controller-a', 'perf-br-req-in': '1580465062.135', 'user-agent': 'curl/7.54.0', 'x-forwarded-for': '91.171.237.190, 10.250.205.238', 'x-forwarded-host': 'adobeioruntime.net', 'x-forwarded-port': '443', 'x-forwarded-proto': 'https', 'x-real-ip': '10.250.205.238', 'x-request-id': 'oV7T8FdYXnipfm2P7Jtn2YQpDNP7F5kv' }, __ow_method: 'get', __ow_path: '' } }
2020-01-31T10:04:22.150Z stderr: [ERROR] log.error
2020-01-31T10:04:22.150Z stderr: [WARN] log.warn
2020-01-31T10:04:22.150Z stderr: [INFO] log.info
2020-01-31T10:04:22.150Z stderr: [DEBUG] log.debug
2020-01-31T10:04:22.151Z stderr: [TRACE] log.trace
2020-01-31T10:04:22.151Z stderr: [TRACE] result { result: { body: 'Done. LOG_LEVEL parameter: trace. Logger level: silly.\n' } }
# -> result as expected
# run silly version
$ git checkout silly
$ rm -fr dist; npm run deploy >/dev/null 2>&1; curl https://adobeioruntime.net/api/v1/web/acapt/helix-services-private/[email protected]; sleep 7; wsk activation logs --last
Done. LOG_LEVEL parameter: silly. Logger level: silly.
2020-01-31T10:05:04.731Z stderr: [TRACE] before { params: { __ow_headers: { accept: '*/*', connection: 'close', host: 'controller-a', 'perf-br-req-in': '1580465104.717', 'user-agent': 'curl/7.54.0', 'x-forwarded-for': '91.171.237.190, 10.250.205.238', 'x-forwarded-host': 'adobeioruntime.net', 'x-forwarded-port': '443', 'x-forwarded-proto': 'https', 'x-real-ip': '10.250.205.238', 'x-request-id': 'oL3uD45j1KnQ6mXt3xgoTCbTc4qsUcC4' }, __ow_method: 'get', __ow_path: '' } }
2020-01-31T10:05:04.731Z stderr: [ERROR] log.error
2020-01-31T10:05:04.731Z stderr: [WARN] log.warn
2020-01-31T10:05:04.732Z stderr: [INFO] log.info
2020-01-31T10:05:04.732Z stderr: [DEBUG] log.debug
2020-01-31T10:05:04.732Z stderr: [TRACE] log.trace
2020-01-31T10:05:04.733Z stderr: [TRACE] result { result: { body: 'Done. LOG_LEVEL parameter: silly. Logger level: silly.\n' } }
# -> log.silly is missing!
# run debug version again
$ git checkout debug
$ rm -fr dist; npm run deploy >/dev/null 2>&1; curl https://adobeioruntime.net/api/v1/web/acapt/helix-services-private/[email protected]; sleep 7; wsk activation logs --last
Done. LOG_LEVEL parameter: debug. Logger level: silly.
$
# -> no log at all!!
Multiple issues:
log.silly
never outputs something__ow_logger.logger.level
is always silly
(which might be expected) - would be great to adjust the code to output the real logger levelcc @tripodsan
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Add a new level
parameter to init()
and logger()
that can set the overall log-level.
if none specified it falls back to params.LOG_LEVEL
and eventually to info
.
do we still need this?
https://github.com/adobe/helix-universal-logger is the successor to use with helix-universal
The following line:
openwhisk-action-logger/src/logger.js
Line 60 in ecb6d9d
looks wrong, as it does not parse the contents of the .env
file, but its path.
Currently it is not possible for the init script to add more dynamic fields. The current activationId is only possible, because it uses process.env.
I think using the concept of a child logger that sets the fields in init()
based on the params would be more powerful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.