Skip to content

Commit

Permalink
change feature flag name
Browse files Browse the repository at this point in the history
Signed-off-by: Flyingliuhub <33105471+flyingliuhub@users.noreply.github.com>
  • Loading branch information
Flyingliuhub committed May 7, 2024
1 parent de310cf commit 893f6db
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/opensearch_dashboards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
# This configuration option controls the handling of error messages in the logging stream. It is disabled by default.
# When set to true, the 'ENOSPC' error message will not cause the OpenSearch Dashboards process to crash. Otherwise,
# the original behavior will be maintained.
#logging.streamErrorHandling: false
#logging.ignoreEnospcError: false

# Set the value of this setting to true to suppress all logging output.
#logging.silent: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ opensearch_dashboards_vars=(
opensearchDashboards.defaultAppId
opensearchDashboards.index
logging.dest
logging.ignoreEnospcError
logging.json
logging.quiet
logging.rotate.enabled
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/config/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default () =>
}),
events: Joi.any().default({}),
dest: Joi.string().default('stdout'),
streamErrorHandling: Joi.boolean().default(false),
ignoreEnospcError: Joi.boolean().default(false),
filter: Joi.any().default({}),
json: Joi.boolean().when('dest', {
is: 'stdout',
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/logging/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function loggingConfiguration(config) {
json: config.get('logging.json'),
dest: config.get('logging.dest'),
timezone: config.get('logging.timezone'),
streamErrorHandling: config.get('logging.streamErrorHandling'),
ignoreEnospcError: config.get('logging.ignoreEnospcError'),

// I'm adding the default here because if you add another filter
// using the commandline it will remove authorization. I want users
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/server/logging/log_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function getLoggerStream({ events, config }) {
encoding: 'utf8',
});

if (config.streamErrorHandling) {
if (config.ignoreEnospcError) {
pipeline(logInterceptor, squeeze, format, dest, onFinished);

Check warning on line 63 in src/legacy/server/logging/log_reporter.js

View check run for this annotation

Codecov / codecov/patch

src/legacy/server/logging/log_reporter.js#L62-L63

Added lines #L62 - L63 were not covered by tests
} else {
logInterceptor.on('end', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/server/logging/log_reporter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('getLoggerStream', () => {
expect(lines[0]).toMatch(/^log \[[^\]]*\] \[foo\] test data$/);
});

it('should log to custom file when the json config is set to true and streamErrorHandling', async () => {
it('should log to custom file when the json config is set to true and ignoreEnospcError', async () => {
const dir = os.tmpdir();
const logfile = `dest-${Date.now()}.log`;
const dest = path.join(dir, logfile);
Expand All @@ -102,7 +102,7 @@ describe('getLoggerStream', () => {
config: {
json: true,
dest,
streamErrorHandling: true,
ignoreEnospcError: true,
filter: {},
},
events: { log: '*' },
Expand Down

0 comments on commit 893f6db

Please sign in to comment.