Guest User

Untitled

a guest
Nov 16th, 2020
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. input {
  2. beats {
  3. port => 5044
  4. ssl => true
  5. ssl_certificate_authorities => ["/etc/elk/certs/ca/ca.crt"]
  6. ssl_certificate => "/etc/elk/instances/instances.crt"
  7. ssl_key => "/etc/elk/instances/logs.pkcs8.key"
  8. ssl_key_passphrase => "*secret*"
  9. ssl_verify_mode => "force_peer"
  10. }
  11. }
  12. filter {
  13. if [agent][type] == "auditbeat" {
  14. if [event][dataset] != "login" {
  15. drop {}
  16. } else {
  17. mutate {
  18. add_tag => ["important"]
  19. }
  20. }
  21. }
  22. if [log][file][path] = ~"mongo.*\.log$" {
  23. grok {
  24. match => {
  25. "message" => "\A%{TIMESTAMP_ISO8601} I ACCESS %{NOTSPACE} SCRAM-SHA-1 authentication failed for %{USER:User} on %{USER:DB} from client %{SYSLOGHOST:From}:%{INT:Port} ; %{GREEDYDATA:Reason}"
  26. }
  27.  
  28. }
  29. mutate {
  30. add_tag => ["mongosIfStatement"]
  31. }
  32. mutate {
  33. add_tag => ["important"]
  34. }
  35. }
  36. if [log][file][path] = ~"mysql.*\.log$" {
  37. grok {
  38. match => {
  39. "message" => "%{TIMESTAMP_ISO8601:Date} %{INT:Number} \[Note] Access denied for user '%{USER:User}'@'%{SYSLOGHOST:IP}' \(using password: %{WORD:Password}%{GREEDYDATA}"
  40. }
  41. }
  42. mutate {
  43. add_tag => ["important"]
  44. }
  45. mutate {
  46. add_tag => ["MySQLloginfail"]
  47. }
  48. }
  49. if [log][file][path] = ~/\.json$/ {
  50. json {
  51. source => "message"
  52. }
  53. }
  54. if [log][file][path] = ~"commands.log" {
  55. grok {
  56. match => {
  57. "message" => "\A%{SYSLOGTIMESTAMP:sys_timestamp} %{NOTSPACE:Hostname} %{USER:Logged}: USER=%{USER:User} PWD=%{UNIXPATH:Directory} PID=\[%{INT:PID}] CMD=\"%{DATA:Command}\" Exit=\[%{INT:Exit}\] CONNECTION=%{GREEDYDATA:Connection}"
  58. }
  59. match => {
  60. "message" => ["\[(%{TIMESTAMP_ISO8601:sys_timestamp})\]\s(?<Hostname>[0-9a-zA-Z_-]+)\s(?<Logged>[0-9a-zA-Z_-]+)\:USER=(?<User>[0-9a-zA-Z_-]+)\sPWD=(?<Directory>[0-9a-zA-Z_/-]+)\sPID=\[(?<PID>[0-9]+)\]\sCMD=\"(?<Command>.*)\"\sExit=\[(?<Exit>[0-9]+)\]\sCONNECTION=(?<Connetion>.*)", "\A%{SYSLOGTIMESTAMP:sys_timestamp} %{NOTSPACE:Hostname} %{USER:Logged}: USER=%{USER:User} PWD=%{UNIXPATH:Directory} PID=\[%{INT:PID}] CMD=%{QUOTEDSTRING:Command} Exit=\[%{INT:Exit}] CONNECTION=%{GREEDYDATA:Connection}"]
  61. }
  62. match => {
  63. "message" => "\A%{SYSLOGTIMESTAMP:sys_timestamp} %{HOSTNAME:Hostname} %{USER:Logged}: USER=%{USER:User} PWD=%{UNIXPATH:Directory} PID=\[%{INT:PID}] CMD=%{QUOTEDSTRING:Command} Exit=\[%{INT:Exit}] CONNECTION=%{GREEDYDATA:Connection}"
  64. }
  65. }
  66. mutate {
  67. add_tag => ["important"]
  68. }
  69. }
  70. if "important"
  71. not in [tags] {
  72. drop {}
  73. }
  74. }
  75. output {
  76. if [@metadata][pipeline] {
  77. elasticsearch {
  78. hosts => "https://localhost:9200"
  79. manage_template => false
  80. cacert => "/etc/elasticsearch/estackcap12extract.crt"
  81. ssl => true
  82. ssl_certificate_verification => false
  83. index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
  84. pipeline => "%{[@metadata][pipeline]}"
  85. user => "elastic"
  86. password => "*secret*"
  87. }
  88. } else {
  89. elasticsearch {
  90. # manage_template => false
  91. hosts => ["https://localhost:9200"]
  92. cacert => "/etc/elasticsearch/estackcap12extract.crt"
  93. ssl => true
  94. ssl_certificate_verification => false
  95. index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
  96. #index => "cleandata"
  97. user => "elastic"
  98. password => "*secret*"
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment