diff --git a/metron-deployment/roles/metron_pcapservice/defaults/main.yml b/metron-deployment/roles/metron_pcapservice/defaults/main.yml index c19470a6d8..6be114d5ee 100644 --- a/metron-deployment/roles/metron_pcapservice/defaults/main.yml +++ b/metron-deployment/roles/metron_pcapservice/defaults/main.yml @@ -24,3 +24,6 @@ pcapservice_port: 8081 hbase_config_path: "/etc/hbase/conf" query_hdfs_path: "/tmp" pcap_hdfs_path: "/apps/metron/pcap" +metron_pcapservice_logrotate_frequency: daily +metron_pcapservice_logrotate_retention: 30 + diff --git a/metron-deployment/roles/metron_pcapservice/tasks/main.yml b/metron-deployment/roles/metron_pcapservice/tasks/main.yml index 9afdc3bc2f..ed33354459 100644 --- a/metron-deployment/roles/metron_pcapservice/tasks/main.yml +++ b/metron-deployment/roles/metron_pcapservice/tasks/main.yml @@ -16,3 +16,10 @@ # --- - include: pcapservice.yml + +- name: Create Logrotate Script for metron_pcapservice + template: + src: "metron-pcapservice-logrotate.yml" + dest: "/etc/logrotate.d/metron-pcapservice" + mode: 0644 + diff --git a/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml b/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml new file mode 100644 index 0000000000..f6ff2711ef --- /dev/null +++ b/metron-deployment/roles/metron_pcapservice/templates/metron-pcapservice-logrotate.yml @@ -0,0 +1,26 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +#Metron pcapService +/var/log/metron_pcapservice.log { + {{ metron_pcapservice_logrotate_frequency }} + rotate {{ metron_pcapservice_logrotate_retention }} + missingok + notifempty + copytruncate +} +