nginx_access.conf 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. input {
  2. file {
  3. type => "nginx_access_log"
  4. path => "/usr/local/openresty/nginx/logs/dispatch.comsunny.com*.access.log"
  5. start_position => "beginning"
  6. }
  7. }
  8. input {
  9. file {
  10. type => "nginx_access_log"
  11. path => "/usr/local/openresty/nginx/logs/www.comsunny.com_*.access.log"
  12. start_position => "beginning"
  13. }
  14. }
  15. input {
  16. file {
  17. type => "nginx_access_log"
  18. path => "/usr/local/openresty/nginx/logs/www.*.com.access.log"
  19. start_position => "beginning"
  20. }
  21. }
  22. input {
  23. file {
  24. type => "nginx_access_log"
  25. path => "/usr/local/openresty/nginx/logs/api.comsunny.com_443.access.log"
  26. start_position => "beginning"
  27. }
  28. }
  29. input {
  30. file {
  31. type => "nginx_access_log"
  32. path => "/usr/local/openresty/nginx/logs/internal.comsunny.com_80.access.log"
  33. start_position => "beginning"
  34. }
  35. }
  36. input {
  37. file {
  38. type => "nginx_access_log"
  39. path => "/usr/local/openresty/nginx/logs/uu.taschy.com.access.log"
  40. start_position => "beginning"
  41. }
  42. }
  43. input {
  44. file {
  45. type => "backend_log"
  46. path => "/var/prog/backend/logs/backend.log"
  47. start_position => "beginning"
  48. }
  49. }
  50. filter {
  51. if [type] == "nginx_access_log" {
  52. grok {
  53. patterns_dir => "/opt/logstash/logstash-6.0.0/patterns/nginx"
  54. match => { "message" => "%{NGINX_ACCESS}" }
  55. }
  56. }
  57. }
  58. filter {
  59. if [type] == "backend_log" {
  60. grok {
  61. patterns_dir => "/opt/logstash/logstash-6.0.0/patterns/backend.conf"
  62. match => { "message" => "%{BACKEND_LOG}" }
  63. }
  64. }
  65. }
  66. output {
  67. if [type] == "nginx_access_log" {
  68. elasticsearch {
  69. hosts => ["10.31.88.120:9200"]
  70. index => "nginx_access_log-%{+YYYY-MM-dd}"
  71. }
  72. }
  73. }
  74. output {
  75. if [type] == "backend_log" {
  76. elasticsearch {
  77. hosts => ["10.31.88.120:9200"]
  78. index => "backend_log-%{+YYYY-MM-dd}"
  79. }
  80. }
  81. }