@wnqueiroz/ecs-winston
Version:
A formatter for the winston logger compatible with Elastic Common Schema (ECS) 🚀
1,499 lines (1,498 loc) • 194 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ecsSchema = void 0;
const anyOf = [
{ type: 'null' },
{ type: 'array' },
{ type: 'string' },
{ type: 'number' },
{ type: 'integer' },
{ type: 'boolean' },
{ type: 'object', additionalProperties: true },
];
exports.ecsSchema = {
type: 'object',
additionalProperties: true,
properties: {
'@timestamp': {
type: 'string',
},
labels: {
type: 'object',
additionalProperties: true,
},
message: {
type: 'string',
},
tags: {
type: 'array',
items: {
type: 'string',
},
},
agent: {
type: 'object',
additionalProperties: true,
properties: {
build: {
type: 'object',
additionalProperties: true,
properties: {
original: {
type: 'string',
},
},
},
ephemeral_id: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
type: {
type: 'string',
},
version: {
type: 'string',
},
},
},
client: {
type: 'object',
additionalProperties: true,
properties: {
address: {
type: 'string',
},
as: {
type: 'object',
additionalProperties: true,
properties: {
number: {
type: 'integer',
},
organization: {
type: 'object',
additionalProperties: true,
properties: {
name: {
type: 'string',
},
},
},
},
},
bytes: {
type: 'integer',
},
domain: {
type: 'string',
},
geo: {
type: 'object',
additionalProperties: true,
properties: {
city_name: {
type: 'string',
},
continent_code: {
type: 'string',
},
continent_name: {
type: 'string',
},
country_iso_code: {
type: 'string',
},
country_name: {
type: 'string',
},
location: {
type: 'object',
additionalProperties: true,
properties: {
lon: {
type: 'number',
},
lat: {
type: 'number',
},
},
},
name: {
type: 'string',
},
postal_code: {
type: 'string',
},
region_iso_code: {
type: 'string',
},
region_name: {
type: 'string',
},
timezone: {
type: 'string',
},
},
},
ip: {
type: 'string',
},
mac: {
type: 'string',
},
nat: {
type: 'object',
additionalProperties: true,
properties: {
ip: {
type: 'string',
},
port: {
type: 'integer',
},
},
},
packets: {
type: 'integer',
},
port: {
type: 'integer',
},
registered_domain: {
type: 'string',
},
subdomain: {
type: 'string',
},
top_level_domain: {
type: 'string',
},
user: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
email: {
type: 'string',
},
full_name: {
type: 'string',
},
group: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
hash: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
roles: {
type: 'array',
items: {
type: 'string',
},
},
},
},
},
},
cloud: {
type: 'object',
additionalProperties: true,
properties: {
account: {
type: 'object',
additionalProperties: true,
properties: {
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
availability_zone: {
type: 'string',
},
instance: {
type: 'object',
additionalProperties: true,
properties: {
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
machine: {
type: 'object',
additionalProperties: true,
properties: {
type: {
type: 'string',
},
},
},
project: {
type: 'object',
additionalProperties: true,
properties: {
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
provider: {
type: 'string',
},
region: {
type: 'string',
},
service: {
type: 'object',
additionalProperties: true,
properties: {
name: {
type: 'string',
},
},
},
},
},
container: {
type: 'object',
additionalProperties: true,
properties: {
id: {
type: 'string',
},
image: {
type: 'object',
additionalProperties: true,
properties: {
name: {
type: 'string',
},
tag: {
type: 'string',
},
},
},
labels: {
type: 'object',
additionalProperties: true,
},
name: {
type: 'string',
},
runtime: {
type: 'string',
},
},
},
data_stream: {
type: 'object',
additionalProperties: true,
properties: {
dataset: {
type: 'string',
},
namespace: {
type: 'string',
},
type: {
type: 'string',
},
},
},
destination: {
type: 'object',
additionalProperties: true,
properties: {
address: {
type: 'string',
},
as: {
type: 'object',
additionalProperties: true,
properties: {
number: {
type: 'integer',
},
organization: {
type: 'object',
additionalProperties: true,
properties: {
name: {
type: 'string',
},
},
},
},
},
bytes: {
type: 'integer',
},
domain: {
type: 'string',
},
geo: {
type: 'object',
additionalProperties: true,
properties: {
city_name: {
type: 'string',
},
continent_code: {
type: 'string',
},
continent_name: {
type: 'string',
},
country_iso_code: {
type: 'string',
},
country_name: {
type: 'string',
},
location: {
type: 'object',
additionalProperties: true,
properties: {
lon: {
type: 'number',
},
lat: {
type: 'number',
},
},
},
name: {
type: 'string',
},
postal_code: {
type: 'string',
},
region_iso_code: {
type: 'string',
},
region_name: {
type: 'string',
},
timezone: {
type: 'string',
},
},
},
ip: {
type: 'string',
},
mac: {
type: 'string',
},
nat: {
type: 'object',
additionalProperties: true,
properties: {
ip: {
type: 'string',
},
port: {
type: 'integer',
},
},
},
packets: {
type: 'integer',
},
port: {
type: 'integer',
},
registered_domain: {
type: 'string',
},
subdomain: {
type: 'string',
},
top_level_domain: {
type: 'string',
},
user: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
email: {
type: 'string',
},
full_name: {
type: 'string',
},
group: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
hash: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
roles: {
type: 'array',
items: {
type: 'string',
},
},
},
},
},
},
dll: {
type: 'object',
additionalProperties: true,
properties: {
code_signature: {
type: 'object',
additionalProperties: true,
properties: {
digest_algorithm: {
type: 'string',
},
exists: {
type: 'boolean',
},
signing_id: {
type: 'string',
},
status: {
type: 'string',
},
subject_name: {
type: 'string',
},
team_id: {
type: 'string',
},
timestamp: {
type: 'string',
},
trusted: {
type: 'boolean',
},
valid: {
type: 'boolean',
},
},
},
hash: {
type: 'object',
additionalProperties: true,
properties: {
md5: {
type: 'string',
},
sha1: {
type: 'string',
},
sha256: {
type: 'string',
},
sha512: {
type: 'string',
},
ssdeep: {
type: 'string',
},
},
},
name: {
type: 'string',
},
path: {
type: 'string',
},
pe: {
type: 'object',
additionalProperties: true,
properties: {
architecture: {
type: 'string',
},
company: {
type: 'string',
},
description: {
type: 'string',
},
file_version: {
type: 'string',
},
imphash: {
type: 'string',
},
original_file_name: {
type: 'string',
},
product: {
type: 'string',
},
},
},
},
},
dns: {
type: 'object',
additionalProperties: true,
properties: {
answers: {
type: 'object',
additionalProperties: true,
properties: {
class: {
type: 'string',
},
data: {
type: 'string',
},
name: {
type: 'string',
},
ttl: {
type: 'integer',
},
type: {
type: 'string',
},
},
},
header_flags: {
type: 'array',
items: {
type: 'string',
},
},
id: {
type: 'string',
},
op_code: {
type: 'string',
},
question: {
type: 'object',
additionalProperties: true,
properties: {
class: {
type: 'string',
},
name: {
type: 'string',
},
registered_domain: {
type: 'string',
},
subdomain: {
type: 'string',
},
top_level_domain: {
type: 'string',
},
type: {
type: 'string',
},
},
},
resolved_ip: {
type: 'array',
items: {
type: 'string',
},
},
response_code: {
type: 'string',
},
type: {
type: 'string',
},
},
},
ecs: {
type: 'object',
additionalProperties: true,
properties: {
version: {
type: 'string',
},
},
},
error: {
type: 'object',
additionalProperties: true,
properties: {
code: {
type: 'string',
},
id: {
type: 'string',
},
message: {
type: 'string',
},
stack_trace: {
type: 'string',
},
type: {
type: 'string',
},
},
},
event: {
type: 'object',
additionalProperties: true,
properties: {
action: {
type: 'string',
},
agent_id_status: {
type: 'string',
},
category: {
type: 'string',
},
code: {
type: 'string',
},
created: {
type: 'string',
},
dataset: {
type: 'string',
},
duration: {
type: 'integer',
},
end: {
type: 'string',
},
hash: {
type: 'string',
},
id: {
type: 'string',
},
ingested: {
type: 'string',
},
kind: {
type: 'string',
},
module: {
type: 'string',
},
original: {
type: 'string',
},
outcome: {
type: 'string',
},
provider: {
type: 'string',
},
reason: {
type: 'string',
},
reference: {
type: 'string',
},
risk_score: {
type: 'integer',
},
risk_score_norm: {
type: 'integer',
},
sequence: {
type: 'integer',
},
severity: {
type: 'integer',
},
start: {
type: 'string',
},
timezone: {
type: 'string',
},
type: {
type: 'string',
},
url: {
type: 'string',
},
},
},
file: {
type: 'object',
additionalProperties: true,
properties: {
accessed: {
type: 'string',
},
attributes: {
type: 'array',
items: {
type: 'string',
},
},
code_signature: {
type: 'object',
additionalProperties: true,
properties: {
digest_algorithm: {
type: 'string',
},
exists: {
type: 'boolean',
},
signing_id: {
type: 'string',
},
status: {
type: 'string',
},
subject_name: {
type: 'string',
},
team_id: {
type: 'string',
},
timestamp: {
type: 'string',
},
trusted: {
type: 'boolean',
},
valid: {
type: 'boolean',
},
},
},
created: {
type: 'string',
},
ctime: {
type: 'string',
},
device: {
type: 'string',
},
directory: {
type: 'string',
},
drive_letter: {
type: 'string',
},
elf: {
type: 'object',
additionalProperties: true,
properties: {
architecture: {
type: 'string',
},
byte_order: {
type: 'string',
},
cpu_type: {
type: 'string',
},
creation_date: {
type: 'string',
},
exports: {
type: 'string',
},
header: {
type: 'object',
additionalProperties: true,
properties: {
abi_version: {
type: 'string',
},
class: {
type: 'string',
},
data: {
type: 'string',
},
entrypoint: {
type: 'integer',
},
object_version: {
type: 'string',
},
os_abi: {
type: 'string',
},
type: {
type: 'string',
},
version: {
type: 'string',
},
},
},
imports: {
type: 'string',
},
sections: {
type: 'object',
additionalProperties: true,
properties: {
chi2: {
type: 'integer',
},
entropy: {
type: 'integer',
},
flags: {
type: 'string',
},
name: {
type: 'string',
},
physical_offset: {
type: 'string',
},
physical_size: {
type: 'integer',
},
type: {
type: 'string',
},
virtual_address: {
type: 'integer',
},
virtual_size: {
type: 'integer',
},
},
},
segments: {
type: 'object',
additionalProperties: true,
properties: {
sections: {
type: 'string',
},
type: {
type: 'string',
},
},
},
shared_libraries: {
type: 'string',
},
telfhash: {
type: 'string',
},
},
},
extension: {
type: 'string',
},
fork_name: {
type: 'string',
},
gid: {
type: 'string',
},
group: {
type: 'string',
},
hash: {
type: 'object',
additionalProperties: true,
properties: {
md5: {
type: 'string',
},
sha1: {
type: 'string',
},
sha256: {
type: 'string',
},
sha512: {
type: 'string',
},
ssdeep: {
type: 'string',
},
},
},
inode: {
type: 'string',
},
mime_type: {
type: 'string',
},
mode: {
type: 'string',
},
mtime: {
type: 'string',
},
name: {
type: 'string',
},
owner: {
type: 'string',
},
path: {
type: 'string',
},
pe: {
type: 'object',
additionalProperties: true,
properties: {
architecture: {
type: 'string',
},
company: {
type: 'string',
},
description: {
type: 'string',
},
file_version: {
type: 'string',
},
imphash: {
type: 'string',
},
original_file_name: {
type: 'string',
},
product: {
type: 'string',
},
},
},
size: {
type: 'integer',
},
target_path: {
type: 'string',
},
type: {
type: 'string',
},
uid: {
type: 'string',
},
x509: {
type: 'object',
additionalProperties: true,
properties: {
alternative_names: {
type: 'string',
},
issuer: {
type: 'object',
additionalProperties: true,
properties: {
common_name: {
type: 'string',
},
country: {
type: 'string',
},
distinguished_name: {
type: 'string',
},
locality: {
type: 'string',
},
organization: {
type: 'string',
},
organizational_unit: {
type: 'string',
},
state_or_province: {
type: 'string',
},
},
},
not_after: {
type: 'string',
},
not_before: {
type: 'string',
},
public_key_algorithm: {
type: 'string',
},
public_key_curve: {
type: 'string',
},
public_key_exponent: {
type: 'integer',
},
public_key_size: {
type: 'integer',
},
serial_number: {
type: 'string',
},
signature_algorithm: {
type: 'string',
},
subject: {
type: 'object',
additionalProperties: true,
properties: {
common_name: {
type: 'string',
},
country: {
type: 'string',
},
distinguished_name: {
type: 'string',
},
locality: {
type: 'string',
},
organization: {
type: 'string',
},
organizational_unit: {
type: 'string',
},
state_or_province: {
type: 'string',
},
},
},
version_number: {
type: 'string',
},
},
},
},
},
group: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
host: {
type: 'object',
additionalProperties: true,
properties: {
architecture: {
type: 'string',
},
cpu: {
type: 'object',
additionalProperties: true,
properties: {
usage: {
type: 'integer',
},
},
},
disk: {
type: 'object',
additionalProperties: true,
properties: {
read: {
type: 'object',
additionalProperties: true,
properties: {
bytes: {
type: 'integer',
},
},
},
write: {
type: 'object',
additionalProperties: true,
properties: {
bytes: {
type: 'integer',
},
},
},
},
},
domain: {
type: 'string',
},
geo: {
type: 'object',
additionalProperties: true,
properties: {
city_name: {
type: 'string',
},
continent_code: {
type: 'string',
},
continent_name: {
type: 'string',
},
country_iso_code: {
type: 'string',
},
country_name: {
type: 'string',
},
location: {
type: 'object',
additionalProperties: true,
properties: {
lon: {
type: 'number',
},
lat: {
type: 'number',
},
},
},
name: {
type: 'string',
},
postal_code: {
type: 'string',
},
region_iso_code: {
type: 'string',
},
region_name: {
type: 'string',
},
timezone: {
type: 'string',
},
},
},
hostname: {
type: 'string',
},
id: {
type: 'string',
},
ip: {
type: 'string',
},
mac: {
type: 'array',
items: {
type: 'string',
},
},
name: {
type: 'string',
},
network: {
type: 'object',
additionalProperties: true,
properties: {
egress: {
type: 'object',
additionalProperties: true,
properties: {
bytes: {
type: 'integer',
},
packets: {
type: 'integer',
},
},
},
ingress: {
type: 'object',
additionalProperties: true,
properties: {
bytes: {
type: 'integer',
},
packets: {
type: 'integer',
},
},
},
},
},
os: {
type: 'object',
additionalProperties: true,
properties: {
family: {
type: 'string',
},
full: {
type: 'string',
},
kernel: {
type: 'string',
},
name: {
type: 'string',
},
platform: {
type: 'string',
},
type: {
type: 'string',
},
version: {
type: 'string',
},
},
},
type: {
type: 'string',
},
uptime: {
type: 'integer',
},
user: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
email: {
type: 'string',
},
full_name: {
type: 'string',
},
group: {
type: 'object',
additionalProperties: true,
properties: {
domain: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
},
},
hash: {
type: 'string',
},
id: {
type: 'string',
},
name: {
type: 'string',
},
roles: {
type: 'array',
items: {
type: 'string',
},
},
},
},
},
},
http: {
type: 'object',
additionalProperties: true,
properties: {
request: {
type: 'object',
additionalProperties: true,
properties: {
body: {
type: 'object',
additionalProperties: true,
properties: {
bytes: {
type: 'integer',
},
content: {
anyOf,
},
},
},
bytes: {
type: 'integer',
},
id: {
type: 'string',
},
method: {
type: 'string',
},
mime_type: {
type: 'string',
},
referrer: {
type: 'string',
},
},
},
response: {
type: 'object',
additionalProperties: true,
properties: {
body: {
type: 'object',
additionalProperties: true,
properties: {
bytes: {
type: 'integer',
},
content: {
anyOf,
},
},
},
bytes: {
type: 'integer',
},
mime_type: {
type: 'string',
},
status_code: {
type: 'integer',
},
},
},
version: {
type: 'string',
},
},
},
log: {
type: 'object',
additionalProperties: true,
properties: {
file: {
type: 'object',
additionalProperties: true,
properties: {
path: {
type: 'string',
},
},
},
level: {
type: 'string',
},
logger: {
type: 'string',
},
origin: {
type: 'object',
additionalProperties: true,
properties: {
file: {
type: 'object',
additionalProperties: true,
properties: {
line: {
type: 'integer',
},
name: {
type: 'string',
},
},
},
function: {
type: 'string',
},
},
},
original: {
type: 'string',
},
syslog: {
type: 'object',
additionalProperties: true,
properties: {
facility: {
type: 'object',
additionalProperties: true,
properties: {
code: {
type: 'integer',
},
name: {
type: 'string',
},
},
},
priority: {
type: 'integer',
},
severity: {
type: 'object',
additionalProperties: true,
properties: {
code: {