linux <log> manage

本文详细介绍了系统日志管理的配置文件、存放位置及常用命令,并阐述了使用logrotate命令进行日志管理的方法,包括配置文件的编写、常用选项及其作用。

日志管理


系统日志的配置文件:

/etc/rsyslog.conf fedora

/etc/rsyslog.d/*.conf(debian)


日志都放在/var/log/目录:

/var/log/message发布内核启动信息,通用日志文件,默认写入这个日志文件。

/var/log/secure与安全相关的日志信息

/var/log/maillog邮件服务器日志

/var/log/cron与定时任务相关的日志信息

/var/log/spoolerUUCPnews设备相关的日志信息

/var/log/boot.log系统启动信息

/var/log/httpdweb服务器日志

/var/log/auth.log用户认证日志

/var/log/dmesg系统启动信息

/var/log/xorg.0.logx服务器日志


logger命令管理系统日志文件:

logger text text内容写入到/var/log/message

-t tag 添加一个tag标记

-f logname 将另一个日志文件的最后一行写入/var/log/message


logrotate命令管理日志:

配置文件:/etc/logrotate.d/XXX内容:

/var/log/XXX.log{

}

Missingok如果日志文件丢失则忽略

Notifempty当源日志文件非空时才进行轮替

Compress允许用gzip压缩较久的日志

Create mode owner group 指定所要创建的归档文件的模式属主 属组

Daily指定进行轮替的时间间隔

Monthly

Weekly

Yearly

Sizesize 限制轮替的日志文件大小

Rotate n 需要保留的旧日志文件的归档数量,XXX.log.1.gz…XXX.log.n.gc


未完待续......

人进商城管理中心 0.00 今日销售总额 0 今日订单数 0 今日注册会员 0 今日入驻店铺数 0 / 8 待审核/店铺总数 待处理 936 个 待处理佣金 52 个 待审核商品 2 个 会员充值 4 个 会员提现 1 个 会员留言 725 个 商品评论 148 个 用户晒单 4 个 标签审核 0 个 商品 220 件 自营商品总数 115 件 入驻商商品总数 105 件 库存警告商品数 57 件 新品推荐数 110 件 精品推荐数 48 件 热销商品数 24 件 促销商品数 0 件 已下架商品总数 73 件 订单 39 笔 待发货订单 0 笔 待支付订单 0 笔 待确认订单 0 笔 部分发货订单 0 笔 退款申请 170 笔 退货申请 5 笔 新缺货登记 0 笔 已成交订单数 2 笔 订单来源统计 订单排行统计 销售额统计 系统信息 服务器操作系统: Linux (192.168.0.142) Web 服务器: nginx/1.20.2 PHP 版本: 5.6.40 MySQL 版本: 5.7.42-log 安全模式: 否 安全模式GID: 否 Socket 支持: 是 时区设置: PRC GD 版本: GD2 ( JPEG GIF PNG) Zlib 支持: 是 IP 库版本: 20071024 文件上传的最大大小: 100M 人进商城1.0版 安装日期: 2017-05-18 编码: UTF-8 人进商城: szrengjing.com 强烈建议您将data/config.php文件属性设置为644(linu/unix)或只读权限(WinNT) 强烈建议您在网站上线之后将后台入口目录admin重命名,可增加系统安全性 请注意定期做好数据备份,数据的定期备份可最大限度的保障您网站数据的安全 人进商城: <?php define('IN_ECS', true); require_once('../includes/init.php'); // 检查管理员权限 admin_priv('users_manage'); // 需要用户管理权限 // 连接数据库 $pdo = new PDO("mysql:host=localhost;dbname=szrengjing_com", "szrengjing_com", "ZparETNy4DTZBAiT"); $pdo->exec("SET NAMES utf8"); // 获取搜索参数 $user_id = $_GET['user_id'] ?? null; $start_date = $_GET['start_date'] ?? date('Y-m-01'); // 默认本月开始 $end_date = $_GET['end_date'] ?? date('Y-m-d H:i:s'); // 查询语句 $sql = "SELECT l.*, u.username FROM ecs_user_credit_log l LEFT JOIN ecs_users u ON l.user_id = u.id WHERE 1=1"; $params = []; if ($user_id) { $sql .= " AND l.user_id = ?"; $params[] = $user_id; } if ($start_date) { $sql .= " AND l.created_at >= ?"; $params[] = $start_date . ' 00:00:00'; } if ($end_date) { $sql .= " AND l.created_at <= ?"; $params[] = $end_date . ' 23:59:59'; } $sql .= " ORDER BY l.created_at DESC LIMIT 100"; $stmt = $pdo->prepare($sql); $stmt->execute($params); $logs = $stmt->fetchAll(PDO::FETCH_ASSOC); ?> <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8" /> <title>信用日志管理后台</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" /> </head> <body class="p-4"> <h2 class="mb-4">📊 用户信用变更日志</h2> <!-- 搜索表单 --> <form method="get" class="mb-4 bg-light p-3 rounded"> <div class="row"> <div class="col-md-3"> <label>用户ID:</label> <input type="number" name="user_id" class="form-control" value="<?= htmlspecialchars($user_id) ?>" /> </div> <div class="col-md-3"> <label>起始日期:</label> <input type="date" name="start_date" class="form-control" value="<?= $start_date ? date('Y-m-d', strtotime($start_date)) : '' ?>" /> </div> <div class="col-md-3"> <label>结束日期:</label> <input type="datetime-local" name="end_date" class="form-control" value="<?= $end_date ? date('Y-m-d\TH:i', strtotime($end_date)) : '' ?>" /> </div> <div class="col-md-3 d-flex align-items-end"> <button type="submit" class="btn btn-primary">查询</button> </div> </div> </form> <!-- 日志表格 --> <table class="table table-striped table-hover"> <thead> <tr> <th>ID</th> <th>用户ID</th> <th>用户名</th> <th>旧分值</th> <th>新分值</th> <th>变化值</th> <th>原因</th> <th>时间</th> </tr> </thead> <tbody> <?php foreach ($logs as $log): ?> <tr> <td><?= $log['id'] ?></td> <td><?= $log['user_id'] ?></td> <td><?= htmlspecialchars($log['username'] ?? '未知') ?></td> <td><?= $log['old_score'] ?></td> <td><?= $log['new_score'] ?></td> <td class="<?= $log['change_value'] > 0 ? 'text-success' : ($log['change_value'] < 0 ? 'text-danger' : '') ?>"> <?= $log['change_value'] ?> </td> <td><?= htmlspecialchars($log['reason']) ?></td> <td><?= $log['created_at'] ?></td> </tr> <?php endforeach; ?> </tbody> </table> <?php if (empty($logs)): ?> <p class="text-muted text-center">🔍 没有找到符合条件的记录。</p> <?php endif; ?> </body> </html>
11-10
行 6702: <6>[ 69.098331][ T8] xhci-mtk 11200000.xhci0: USB3 root hub has no ports 行 6709: <6>[ 69.099532][ T8] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.01 行 6709: <6>[ 69.099532][ T8] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.01 行 6709: <6>[ 69.099532][ T8] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 6.01 行 6710: <6>[ 69.099552][ T8] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 行 6710: <6>[ 69.099552][ T8] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 行 6710: <6>[ 69.099552][ T8] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 行 6711: <6>[ 69.099559][ T8] usb usb1: Product: xHCI Host Controller 行 6711: <6>[ 69.099559][ T8] usb usb1: Product: xHCI Host Controller 行 6712: <6>[ 69.099565][ T8] usb usb1: Manufacturer: Linux 6.1.134-android14-11-o-g9e523b34f059 xhci-hcd 行 6712: <6>[ 69.099565][ T8] usb usb1: Manufacturer: Linux 6.1.134-android14-11-o-g9e523b34f059 xhci-hcd 行 6713: <6>[ 69.099571][ T8] usb usb1: SerialNumber: 11200000.xhci0 行 6713: <6>[ 69.099571][ T8] usb usb1: SerialNumber: 11200000.xhci0 行 6714: <6>[ 69.100769][ T8] hub 1-0:1.0: USB hub found 行 6716: <6>[ 69.102355][ T8] mtu3 11201000.usb0: max_speed: high-speed 行 6770: <5>[ 69.184314][ T10] USB_BOOST, <vcore_release(), 182> vcore_release: release usb vcore 行 6770: <5>[ 69.184314][ T10] USB_BOOST, <vcore_release(), 182> vcore_release: release usb vcore 行 6771: <5>[ 69.184337][ T10] USB_BOOST, <boost_work(), 358> id:3, end of work 行 6922: <6>[ 70.444264][ T311] usb 1-1: new high-speed USB device number 2 using xhci-mtk 行 6922: <6>[ 70.444264][ T311] usb 1-1: new high-speed USB device number 2 using xhci-mtk 行 6923: <5>[ 70.467164][ T10] USB_BOOST, <boost_work(), 328> id:3, begin of work, timeout:3 行 6924: <5>[ 70.469246][ T10] USB_BOOST, <vcore_hold(), 158> vcore_hold: set usb vcore (725000) 行 6924: <5>[ 70.469246][ T10] USB_BOOST, <vcore_hold(), 158> vcore_hold: set usb vcore (725000) 行 6940: <6>[ 70.641157][ T311] usb 1-1: New USB device found, idVendor=0bc2, idProduct=231a, bcdDevice= 7.10 行 6940: <6>[ 70.641157][ T311] usb 1-1: New USB device found, idVendor=0bc2, idProduct=231a, bcdDevice= 7.10 行 6941: <6>[ 70.641182][ T311] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 行 6941: <6>[ 70.641182][ T311] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3 行 6942: <6>[ 70.641189][ T311] usb 1-1: Product: Expansion 行 6943: <6>[ 70.641194][ T311] usb 1-1: Manufacturer: Seagate 行 6944: <6>[ 70.641200][ T311] usb 1-1: SerialNumber: NAADA21M 底层有识别到设备
10-30
ys@ys-2025:~$ # 添加 NVIDIA 容器运行时仓库 distribution=$(. /etc/os-release; echo $ID$VERSION_ID) \ && curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - \ && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list # 安装组件 sudo apt-get update sudo apt-get install -y nvidia-container-toolkit Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). OK <!doctype html> <html lang="en-US"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="chrome=1"> <!-- Begin Jekyll SEO tag v2.8.0 --> <title>Unsupported distribution or misconfigured repository settings | NVIDIA Container Toolkit</title> <meta name="generator" content="Jekyll v3.10.0" /> <meta property="og:title" content="Unsupported distribution or misconfigured repository settings" /> <meta property="og:locale" content="en_US" /> <meta name="description" content="A collection of utilities for using NVIDIA GPUs in containerized environments." /> <meta property="og:description" content="A collection of utilities for using NVIDIA GPUs in containerized environments." /> <link rel="canonical" href="https://nvidia.github.io/libnvidia-container/404.html" /> <meta property="og:url" content="https://nvidia.github.io/libnvidia-container/404.html" /> <meta property="og:site_name" content="NVIDIA Container Toolkit" /> <meta property="og:type" content="website" /> <meta name="twitter:card" content="summary" /> <meta property="twitter:title" content="Unsupported distribution or misconfigured repository settings" /> <script type="application/ld+json"> {"@context":"https://schema.org","@type":"WebPage","description":"A collection of utilities for using NVIDIA GPUs in containerized environments.","headline":"Unsupported distribution or misconfigured repository settings","url":"https://nvidia.github.io/libnvidia-container/404.html"}</script> <!-- End Jekyll SEO tag --> <link rel="stylesheet" href="/libnvidia-container/assets/css/style.css?v=79609cacbfe2969656c0c426bf1fc89ec3eadddd"> <meta name="viewport" content="width=device-width"> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <div class="wrapper"> <header> <img src="/libnvidia-container/assets/logo.jpg"> <h1>NVIDIA Container Toolkit</h1> <p>A collection of utilities for using NVIDIA GPUs in containerized environments. </p> <p class="view"><a href="https://github.com/NVIDIA/libnvidia-container">View the Project on GitHub <small></small></a></p> </header> <section> <h1 id="unsupported-distribution-or-misconfigured-repository-settings">Unsupported distribution or misconfigured repository settings</h1> <p>If you are seeing this message, it may mean that your are using an <a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#linux-distributions">unsupported distribution</a>.</p> <p>It may also mean that your repositories are incorrectly configured.</p> <p>In order to simplify the release process for the NVIDIA Container Toolkit and its components, we rely on a set of reference repositories which can be used across a number of distributions. The main references repositories and their compatible distributions are (this is not a complete list):</p> <h2 id="generic-deb-package-repository">Generic .deb package repository</h2> <h3 id="compatible-with">Compatible with</h3> <p>Most distributions that use DEB packages. These include:</p> <ul> <li>Ubuntu</li> <li>Debian</li> </ul> <h3 id="repository-list-urls">Repository list URLs</h3> <ul> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list</code></li> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/experimental/deb/nvidia-container-toolkit.list</code></li> </ul> <h3 id="repository-roots">Repository roots</h3> <ul> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/stable/deb</code></li> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/experimental/deb</code></li> </ul> <h2 id="generic-rpm-pakcage-repository">Generic .rpm pakcage repository</h2> <h3 id="compatible-with-1">Compatible with</h3> <p>Most distributions that use RPM packages. These include:</p> <ul> <li>RHEL</li> <li>Fedora</li> </ul> <h3 id="repository-file-urls">Repository file URLs</h3> <ul> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo</code></li> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/experimental/rpm/nvidia-container-toolkit.repo</code></li> </ul> <h3 id="repository-roots-1">Repository roots</h3> <ul> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/stable/rpm</code></li> <li><code class="language-plaintext highlighter-rouge">https://nvidia.github.io/libnvidia-container/experimental/rpm</code></li> </ul> <h2 id="github-pages-repository-structure">GitHub Pages repository structure</h2> <p>The packages here are served from the <a href="https://github.com/NVIDIA/libnvidia-container/tree/gh-pages/"><code class="language-plaintext highlighter-rouge">gh-pages</code> branch</a> of the <code class="language-plaintext highlighter-rouge">github.com/NVIDIA/libnvidia-container</code> repository. The repository folder structure maps directly to the package manager URLs.</p> <p>For example, the repositories discused above can be found at:</p> <ul> <li><code class="language-plaintext highlighter-rouge">stable/deb</code>: https://github.com/NVIDIA/libnvidia-container/tree/gh-pages/stable/deb</li> <li><code class="language-plaintext highlighter-rouge">experimental/deb</code>: https://github.com/NVIDIA/libnvidia-container/tree/gh-pages/experimental/deb</li> <li><code class="language-plaintext highlighter-rouge">stable/rpm</code>: https://github.com/NVIDIA/libnvidia-container/tree/gh-pages/stable/rpm</li> <li><code class="language-plaintext highlighter-rouge">experimental/rpm</code>: https://github.com/NVIDIA/libnvidia-container/tree/gh-pages/experimental/rpm</li> </ul> <p>This also means that packages can be downloaded directly by appending the package filename to the following URLs:</p> <ul> <li><code class="language-plaintext highlighter-rouge">https://raw.githubusercontent.com/NVIDIA/libnvidia-container/gh-pages/stable/deb/amd64/</code></li> <li><code class="language-plaintext highlighter-rouge">https://raw.githubusercontent.com/NVIDIA/libnvidia-container/gh-pages/experimental/deb/amd64/</code></li> <li><code class="language-plaintext highlighter-rouge">https://raw.githubusercontent.com/NVIDIA/libnvidia-container/gh-pages/stable/rpm/amd64/</code></li> <li><code class="language-plaintext highlighter-rouge">https://raw.githubusercontent.com/NVIDIA/libnvidia-container/gh-pages/experimental/rpm/amd64/</code></li> </ul> </section> <footer> <p>This project is maintained by <a href="https://github.com/NVIDIA">NVIDIA</a></p> <p><small>Copyright (c) 2017, NVIDIA CORPORATION.<br/>All rights reserved.</small></p> </footer> </div> <script src="/libnvidia-container/assets/js/scale.fix.js"></script> </body> </html> E: 软件源列表 /etc/apt/sources.list.d/nvidia-container-toolkit.list 第 1 行中的类别 “<!doctype” 无法识别 E: 无法读取源列表。 E: 软件源列表 /etc/apt/sources.list.d/nvidia-container-toolkit.list 第 1 行中的类别 “<!doctype” 无法识别 E: 无法读取源列表。
最新发布
12-17
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值