Purge Old Mongo Logs without User Intervention
One of thecoolest feature of Mongo is the concept of Capped Collection, or “fixed size” collection. They are based ona FIFO queue where the first record to be discharded is the first inserted, andthis is exceptional to create a log-collection that automatically purge all oldlogs without any user intervention.
To be ableto automatically enable this feature on the Log4Net Mongo appender you need to do a little modification to thecode, this is because the original code simply gets a reference to thecollection with this code.
CODE:
connection = MongoServer.Create(mongoConnectionString.ToString());connection.Connect();
var db = connection.GetDatabase(DatabaseName);
collection = db.GetCollection(CollectionName);
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/301743/viewspace-731251/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- PURGE MASTER LOGS語法--MySql資料庫ASTMySql資料庫
- InnoDB purge原理--哪些undo log可purge
- 【Mongo】mongo聚合操作Go
- Oracle Recyclebin - purgeOracle
- 【Mongo】mongo配置檔案Go
- Intervention 影像切割擴充套件套件
- Out With the Old and in With the New
- MySQL purge 清理undoMySql
- [old]wireless筆記筆記
- 【mongo】mongo 欄位型別互轉Go型別
- intervention/image 伺服器圖片裁剪伺服器
- Laravel 使用 Intervention/image 處理圖片Laravel
- 【Mongo】Mongo讀寫分離的實現Go
- 【Mongo】shell命令列模式執行mongo命令Go命令列模式
- SCSS without和withCSS
- unixODBC without the GUIGUI
- How to purge the Oracle Database Recycle BinOracleDatabase
- 解決 scroll-view 元件 [Intervention] 報錯View元件
- mongo 索引解析Go索引
- mongo基本操作Go
- mongo GridFSBucketGo
- 安裝mongoGo
- 管理索引mongo索引Go
- windows.old可以刪除嗎?windows.old檔案的刪除方法Windows
- docker操作mongo+docker的常用操作+mongo與.netDockerGo
- Oracle Drop表(purge)恢復(ODU)Oracle
- Oracle Purge和drop的區別Oracle
- MySQL 5.5 -- innodb_purge_threadsMySqlthread
- Performance Without the Event LoopORMOOP
- scp without interative password
- housekeep arch logs (tested on AIX)AI
- Extents in Materialized Views and Their Logs (18)ZedView
- Materialized View Logs (190)ZedView
- 【Mongo】mongo更新欄位為另一欄位的值Go
- 【Mongo】mongo分片加複製集的備份恢復Go
- 【Mongo】Mongodump 與 mongorestore對mongo進行備份恢復GoREST
- mongo-go-driverGo
- mongo的‘模糊匹配’Go