Skip to content

Instantly share code, notes, and snippets.

@ilanco
Created August 10, 2022 07:37
Show Gist options
  • Save ilanco/0922b30bf3d6de5021e13641cefc5130 to your computer and use it in GitHub Desktop.
Save ilanco/0922b30bf3d6de5021e13641cefc5130 to your computer and use it in GitHub Desktop.
pre
{
"mongod_pre44": {
"title": "MongoDB server log format",
"regex": {
"main": {
"pattern": "^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[,\\.]\\d+[\\+-Z](\\d+)?)\\s+(?<level>\\w)\\s+(?<component>\\w+|-)\\s+\\[?(?<context>-*[^\\0]+?)?\\]\\s+(?<body>[^\\0]*)$"
},
"customdate": {
"pattern": "^(?<timestamp>[A-Z][a-z]{2} [A-Z][a-z]{2} [\\d\\s]+ \\d{2}:\\d{2}:\\d{2}[,\\.]\\d+)\\s+(?<level>\\w)\\s+(?<component>\\w+|-)\\s+\\[?(?<context>-*[^\\0]+?)?\\]\\s+(?<body>[^\\0]*)$"
}
},
"timestamp-format": [
"%Y-%m-%dT%H:%M:%S.%L%z",
"%Y-%m-%dT%H:%M:%S.%LZ",
"%a %b %d %H:%M:%S.%L"
],
"level": {
"critical": "F",
"debug": "D",
"error": "E",
"info": "I",
"warning": "W"
},
"opid-field": "context",
"value": {
"context": {
"kind": "string",
"identifier": true
},
"component": {
"kind": "string",
"identifier": true
},
"body": {
"kind": "string"
},
"protocol": {
"kind": "string"
}
},
"sample": [
{
"line": "2016-11-21T11:55:09.601+0000 I CONTROL [initandlisten] MongoDB starting : pid=19972 port=27017 dbpath=/var/lib/mongodb 32-bit host=ubuntu-512mb-fra1-012"
},
{
"line": "2016-12-24T05:05:49.136+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted"
},
{
"line": "2019-10-30T17:01:47.736+0000 I INDEX [repl writer worker 0] building index using bulk method build may temporarily use up to 500 megabytes of RAM"
},
{
"line": "2022-02-04T22:23:36.126+0900 I COMMAND [conn11619445] command db_name.$cmd command: update { update: \"collection_name\", bypassDocumentValidation: false, ordered: true, updates: [ { q: { hashed_account_id: \"981a1a1b7d4b1e05b8a81a38efa6300b\", account_id: 9357052, chat_id: 287771574613406, media_file_id: { $lt: 2709887929065158656 }, status: \"NORMAL\", joined: true }, u: { $set: { joined: false, processed_at: new Date(1643981015882) } }, multi: true, upsert: false } ], runtimeConstants: { localNow: new Date(1643981015883), clusterTime: Timestamp(1643981015, 786) }, shardVersion: [ Timestamp(532623, 619), ObjectId('5ec3be29a9dc1c30077f420a') ], writeConcern: { w: \"majority\" }, allowImplicitCollectionCreation: false, lsid: { id: UUID(\"a1fb5b97-42a4-48da-a417-cd85928a5451\"), uid: BinData(0, 5369A7D5F1D4A80EF48D0314B06E3C45D54B1327E0F6117C5A7495669E74B011) }, $clusterTime: { clusterTime: Timestamp(1643981015, 786), signature: { hash: BinData(0, 785DBFECA2E39BE46BA95D6E3997CAC98F9E2AE4), keyId: 6998794649309545069 } }, $audit: { $impersonatedUsers: [ { user: \"drawer\", db: \"admin\" } ], $impersonatedRoles: [ { role: \"readWrite\", db: \"drawer\" } ] }, $client: { driver: { name: \"mongo-java-driver|sync\", version: \"4.1.2\" }, os: { type: \"Linux\", name: \"Linux\", architecture: \"amd64\", version: \"4.15.0-156-generic\" }, platform: \"Java/AdoptOpenJDK/11.0.10+9\", mongos: { host: \"talk-drawermediafile-mongos7.pg1.krane.9rum.cc:30000\", client: \"10.92.122.13:1568\", version: \"4.2.12-13\" } }, $configServerState: { opTime: { ts: Timestamp(1643981015, 727), t: 5 } }, $db: \"drawer\" } numYields:21 reslen:415 locks:{ ParallelBatchWriterMode: { acquireCount: { r: 24 } }, ReplicationStateTransition: { acquireCount: { w: 24 } }, Global: { acquireCount: { r: 1, w: 23 } }, Database: { acquireCount: { w: 23 } }, Collection: { acquireCount: { w: 23 } }, Mutex: { acquireCount: { r: 537 } } } flowControl:{ acquireCount: 22, timeAcquiringMicros: 16 } storage:{} protocol:op_msg 242ms"
},
{
"line": "Fri Aug 13 04:01:17.481 I NETWORK [listener] connection accepted from 10.0.5.159:49494 #3 (2 connections now open)"
},
{
"line": "2022-01-10T04:40:45.853-0500 I NETWORK [conn4331] end connection 10.7.31.126:46970 (348 connections now open)"
},
{
"line": "2022-03-31T00:00:00.051Z I NETWORK [conn8812215] end connection 134.85.73.247:50710 (1581 connections now open)"
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment