Elastic cloud logs not appearing in observability logs

548 views Asked by At

The logs appear in my index pattern search when I go to the Analytics > Discover section, but don't appear in Observability > Logs. Not sure what I have to do to get them to show up there. I have already added the application-* prefix to the settings.

no logs observability logs setting inside analytics discover

1

There are 1 answers

0
Clement On BEST ANSWER

Looks like Pino logger for elastic search doesn't format it using the ecs format anymore by default. So I have to enable that in order for that to work.

ECS support

If you want to use Elastic Common Schema, you should install @elastic/ecs-pino-format, as the ecs option of this module has been removed.

const pino = require('pino')
const ecsFormat = require('@elastic/ecs-pino-format')()
const pinoElastic = require('pino-elasticsearch')

const streamToElastic = pinoElastic({
  index: 'an-index',
  consistency: 'one',
  node: 'http://localhost:9200',
  'es-version': 7,
  'flush-bytes': 1000
})

const logger = pino({ level: 'info',  ...ecsFormat  }, streamToElastic)

logger.info('hello world')