Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Recover accidentally deleted Nginx logs     - Oracle 11g logical standby achieve BI needs (Database)

- Create the best introductory tutorial REST API (Linux)

- Ten SCP transfer command example (Linux)

- Android recyclerview cardview (Programming)

- Python substring format (Programming)

- Python Django model within the class meta Detailed (Programming)

- Timing task Crontab under Linux system (Linux)

- How to use Xmanager Remote Desktop and VNC Log (Linux)

- Help you make Git Bisect (Linux)

- The several technical presentation Raid under Linux (Linux)

- Detailed installation of CentOS 6.x (Linux)

- Getting Started Linux Shell Scripting (Programming)

- Element content of Java HashSet change issues (Programming)

- Linux system package manager (rpm, yum, source packages installation) (Linux)

- Oracle inline view updates problems encountered (Database)

- Linux input and output redirection (Linux)

- Linux install Eclipse for C / C ++ Development (Linux)

- Red Hat Enterprise Linux 6.4 Configuring VNC Remote Desktop login access (Linux)

- C language preprocessor command (Programming)

- Hadoop 2.5 Pseudo distribution installation (Server)

 
         
  Recover accidentally deleted Nginx logs
     
  Add Date : 2017-08-31      
         
         
         
  Yesterday met a face questions - how to restore accidentally deleted nginx logs, I was just about to answer the ideas and steps. Night simulation time to recover accidentally deleted and scenes.

Learn about first under / proc directory (remember the exam RHCA when the topic for this directory really a lot). / Proc directory on the Linux system is a file system that proc file system, which is a pseudo-file system. Which holds some of the current information system kernel running state, you can view the associated system hardware and related information currently running processes, you can also change some of the file to change the kernel running. / Proc / PID process information stored is currently running, PID is the process ID, the process ends when the relevant directory will disappear.

Recover accidentally deleted nginx will use to log some files / proc / PID under the first look at what the directory has:

Several simple column:

- Attribute attr process
- Start the execution of the command cmdline
- Cwd current working directory, soft links
- Environ environment variables used in the execution process
- All documents fd process, file, called a file descriptor, the directory of each soft links point to the actual process of open files
- Hard and soft limits restrictions process
- Cgroup cgroup control group information of the process
- Operational status information status process

Nginx log recovery is to use a certain file descriptor fd under, because there are actually connected to each soft points when running nginx open files, including nginx log files.
Below simulation accidentally deleted the recovery process and logs.

See nginx logs:

    [Root @ iZ2876x9bezZ ~] # ll / var / log / nginx /

    total 12

    -rw-r - r-- 1 root root 6991 Aug 12 12:48 access.log

    -rw-r - r-- 1 root root 760 Aug 12 11:44 error.log

Delete the log:

See nginx process ID:

See the process file descriptor information:


Can be seen as a soft link file descriptor 5 points to the file has been deleted, this is what we need to restore the log files.
Check file contents:

You can see the entire contents of the log, and the new content will be added to the log within the file descriptor. Next, the content of these logs can be output to a file, and then perform the nginx reload operation, so you can re-generate a access.log file, and the new contents of the log output into the log file.
     
         
         
         
  More:      
 
- MySQL error: ERROR 1175: You are using safe update mode solution (Database)
- Ubuntu 12.04 installed OpenCV 2.3.1, binary image (Linux)
- About MongoDB query method according to fuzzy field (Database)
- Getting Started with Linux system to learn: how to check the version of SSH on Linux (Linux)
- The Oracle VM VirtualBox use U disk under ubuntu (Linux)
- Proficient in C / C ++ can also find a very good job (Programming)
- Btrfs file system repair techniques (Linux)
- How to run in support UDp Docker container JBoss data virtualization GA (Server)
- How to make Linux a non-root user uses less than 1024 ports (Linux)
- MySQL InnoDB table --BTree basic data structures (Database)
- MySQL optimization tabs (Database)
- GAMIT baseline solution using batch were counted (Linux)
- Oracle 11g RMAN cross-platform transfer table space (Database)
- Run Windows in FreeBSD bhyve (Linux)
- Big Data Common Glossary (Linux)
- Linux System Getting Started Learning: Linux common log file (Linux)
- DB2 manually create a library (Database)
- Source compiler install Nginx (Server)
- The security configuration of Linux (Linux)
- Several Ceph performance optimization of new methods and ideas (2015 SH Ceph Day after flu reference) (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.