docker Deployed in the environment ELK System , Log processing , Keep a log of the last five hours

dockerlog.sh

#!/bin/bash
logs=`find /var/lib/docker/containers/ -name *-json.log`
d1=`date "+%Y%m%d%H"`
d2=`date -d -5hour "+%Y%m%d%H"`
path1=/home/logs/elk/$d1/
path2=/home/logs/elk/$d2/ mkdir -p $path1 for docker_log in $logs
do
cp $docker_log $path1
echo " " > $docker_log
done rm -rf $path2
echo 'success'

The log is kept in /home/elk/ Under the table of contents

/var/lib/docker/containers/ yes docker Log directory of all containers under

Join a scheduled task : Once an hour

crontab -e

 * * * * bash /root/scripts/dockerlog.sh

docker Deploy ELK More articles on log processing

  1. Docker Deploy ELK A collection of logs

    ELK ELK yes Elasticsearch.Logstash.Kibana Abbreviation , Use ELK Because the company uses Spring cloud Deployed multiple microservices , Different microservices have different log files , When there is a problem in production ...

  2. utilize docker Deploy elk Switch log analysis

    Today we're going to talk about using docker Deploy elk Log analysis system , Let's analyze it here elk What is it .elk Namely Elasticsearch,Logstash and Kibana An acronym for . Elasticsearch It's one ...

  3. Docker Deploy ELK And Sentinl Log alarm

    The previous article briefly introduces Docker Deploy ELK, And the use of filebeat collect java journal . In this article, we introduce the log alarm configuration , Here we use Sentinl plug-in unit . 1. modify kibana Parameters Get into elk Containers , Modify the corresponding parameters ...

  4. Docker Deploy elk + filebeat

    Docker Deploy elk + filebeat kibana Open source analysis and visualization platform logstash Log collection tools logstash-forwarder( Original name lubmberjack)elastics ...

  5. docker Mode deployment elk Log search platform

    Docker Deploy ELKF Operation document Premise introduction 1. Built before elk+f+k Using native system software installation mode , because docker The mirror is maturing ,docker Official website and elastic The official website has relevant images and installation documents for reference , various ...

  6. Use Docker Image deployment ELK Log system

    Use Docker Deploy elasticsearch.logstash.kibana Specify the version :6.7.1 ( It is recommended to use the same version . Screen the incompatibilities between the three softwares ) Download mirroring : docker pull elasti ...

  7. Docker Deploy ELK

    1. install docker Front mounting pip sudo yum -y install epel-release sudo yum install python-pip 2. install docker # Install dependency packages yum ...

  8. Docker function ELK Log monitoring system , Sinicization Kibana Interface

    1.ELK Introduction to log monitoring ELK from Elasticsearch.Logstash and Kibana Three components : Elasticsearch It's an open source distributed search engine , Its characteristics are : Distributed , Zero configuration , Auto discovery , Indexes ...

  9. Linux actual combat (20): Not docker Deploy ELK

    Deployment environment : Elasticsearch:7.5.2 Kibana:7.5.2 Logstash:7.5.2 filebeat:7.5.2 redis: The latest version Deployment way :rpm+ Binary package Use architecture Software ...

Random recommendation

  1. shiro Authority management framework and springmvc Integrate

    shiro yes apache The next project , and spring security similar , For the management of user rights ‘ But in terms of ease of use and learning costs ,shiro More advantage , meanwhile shiro Supports integration with many interfaces User and authority management are numerous ...

  2. C And CPP Find online manuals

    1. MSDN The standard and use of https://msdn.microsoft.com/zh-cn/library/3bstk3k5.aspx 2. Cpp Check online . http://www.cpluspl ...

  3. LCD drive 15-3

    test :1:make menuconfig Remove the original driver     Device Drivers  --->             Graphics support  --->      ...

  4. Java Exception mechanism

    Java Anomaly classification An exception indicates that something unexpected happened to the program , Causes errors in the normal process , For example, division in mathematics 0, Open a file that doesn't exist , Users input illegal parameters, etc . stay C We usually deal with this kind of event together with the normal flow of code ...

  5. Javascript Advanced ——( JavaScript Built-in objects --- On -Date,string,charAt,indexOf,split,substring,substr) Take notes

    What is an object JavaScript Everything in is an object , Such as : character string . The number . Array . Functions, etc , Each object has properties and methods . Object properties : Reflecting certain properties of the object , Such as : Length of string . Length and width of image : Object method : In the ...

  6. C The pointer Pointers and arrays Pointer to a two-dimensional array Pointer application

    Read the value of the variable directly to the storage unit identified by the variable name -- Direct addressing Find the address of the variable indirectly through other variables and read the value of the variable -- Indirect addressing Pointer variable storage address Shows the address of the variable Pointer variables must be initialized before they are used , If you don't know where to point , You can point first NULL ...

  7. DropZone( File upload plugin )

    1. html file dropzone The principle is to simulate the form to upload files ,html There are multiple forms of elements in . You can build a form Forms : <form id="dropz" action=&q ...

  8. HDU - 1050

    wa 了 5 All over ?!! (1) front 4 All over , The idea is not simplified , Trying to simulate the whole process , But the call sort Function, because the odd number of rooms and even number of rooms are not unified , There's something wrong with the sequencing . Ideas : Traverse n paragraph , Scan only the unmarked segment at a time ,ans++ And from that paragraph ...

  9. drf View component 、 Authentication component

    View component 1. Basic view url(r'^publish/$', views.PublishView.as_view()), url(r'^publish/(?P<pk>\d+)/$', vi ...

  10. Ubuntu The system establishes a cross compiling environment

    Feiling FET6818 Core board Decompress the compiler : tar zxvf arm-cortex_a9_eabi-4.7-eglibc-2.18.tar.gz  -C/opt Set the default compilation environment : vi /etc/pr ...