forked from colin/disk-space-report
Update README.md
This commit is contained in:
parent
f830108380
commit
d63412221f
36
README.md
36
README.md
|
@ -9,34 +9,28 @@ This script allows you to retrieve logs from a server based on a specified date
|
|||
- Ensures logs are only retrieved within the given time frame.
|
||||
- Checks if `journalctl` is available on the system before execution.
|
||||
|
||||
## Usage
|
||||
|
||||
To use this script, you can execute it directly from the URL without downloading it.
|
||||
|
||||
### Execute Directly from URL
|
||||
|
||||
Run the script directly from the URL using `curl` and piping to `bash`:
|
||||
### Usage
|
||||
|
||||
```bash
|
||||
curl -sSL https://git.nixc.us/colin/pull-logs/raw/branch/main/pull-logs.sh | bash -s -- <start-date> <start-time> <end-date> <end-time>
|
||||
curl -sSL https://git.nixc.us/colin/pull-logs/raw/branch/main/pull-logs.sh | bash -s -- 2024-09-28 11:35 5
|
||||
```
|
||||
|
||||
### Example
|
||||
### Output
|
||||
|
||||
To pull logs between `2024-09-26 08:00:00` and `2024-09-26 12:00:00`, use:
|
||||
This script will:
|
||||
|
||||
1. Collect logs from `journalctl` within the 5-minute range before and after the specified target time (Saturday, September 28, 2024, at 11:35 am).
|
||||
2. Search through relevant files in `/var/log/` (such as `syslog`, `auth.log`, and `kern.log`).
|
||||
3. Check for logs from specific services (e.g., `nginx`, `apache2`, `mysql`).
|
||||
4. Print all logs to `stdout` for easy piping into a file.
|
||||
|
||||
You can pipe the output to a file:
|
||||
|
||||
```bash
|
||||
curl -sSL https://git.nixc.us/colin/pull-logs/raw/branch/main/pull-logs.sh | bash -s -- 2024-09-26 08:00:00 2024-09-26 12:00:00
|
||||
curl -sSL https://git.nixc.us/colin/pull-logs/raw/branch/main/pull-logs.sh | bash -s -- 2024-09-28 11:35 5 > logs_output.txt
|
||||
```
|
||||
|
||||
## Output
|
||||
### Notes
|
||||
|
||||
The script will provide the following output:
|
||||
|
||||
- The range of the logs retrieved.
|
||||
- The location where the logs are saved (in `/tmp` with a filename indicating the time range).
|
||||
- A message indicating if `journalctl` is not available on the system.
|
||||
|
||||
## Note
|
||||
|
||||
This script assumes the logs are managed by `journalctl`. It may require `sudo` privileges to access certain system logs. Ensure you have appropriate permissions to execute the script.
|
||||
- The script assumes all logs follow a standard timestamp pattern and will adjust based on the service if necessary.
|
||||
- If additional service logs are required, you can extend the `service_logs` array with the path to those log files.
|
Loading…
Reference in New Issue