LoginSignup
0
0

More than 5 years have passed since last update.

mongodbでapacheのアクセスログから.cssと.jsを除外する方法

Posted at

mongodbにapacheのアクセスログを突っ込んだときにjsとcssが邪魔な場合があるのでその時に除外する方法

sample.js
#pathの部分は/hoge/fuga?a=2&b=cみたいな形でデータに入ってる
db.raw_access.find({path : /^((?!\.css|.js).)*$/}, {path : 1}).forEach(function (x){
    print(x.path);
});
#.cssと.jsが除外されたものが出力される
mongo --quiet localhost/apache raw_access.js
#何も出力されない
mongo --quiet localhost/apache raw_access.js | grpe css
#何も出力されない
mongo --quiet localhost/apache raw_access.js | grpe js

shellのgrepと組み合わせると確認も比較的楽です

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0