惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - Franky
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
有赞技术团队
有赞技术团队
美团技术团队
Last Week in AI
Last Week in AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Engineering at Meta
Engineering at Meta
T
Tailwind CSS Blog
J
Java Code Geeks
Martin Fowler
Martin Fowler
I
InfoQ
小众软件
小众软件
MongoDB | Blog
MongoDB | Blog

Stonecharioteer on Tech

I Traced My Traffic Through a Home Tailscale Exit Node What Was I Reading Last? In Three Not-So-Easy Pieces Dogfooding Is Hard Code blocks in your books, finally GoForGo v0.9.0 Merrilin - We built an app to read books I use a Macbook now Data Structures & Algorithms - Preparing for Interviews Using a local DNS namespace for local service discovery Direction KOllector - Publishing KOReader Highlights gbt: branches touched in the last 24 hours A Soiree into Symbols in Ruby Some Smalltalk about Ruby Loops Ruby Blocks Returning from Ruby Blocks, Procs and Lambdas My Linux Laptop Finally Works: How Claude Helped Me Fix Years of Annoyances TIL: Watchexec - Modern File Watching for Development Workflows A Less Busy Mind GoForGo - Learn Go through live examples Migrating My Old Blog to Hugo with Claude The Qtile Window Manager: A Python-Powered Tiling Experience Read the RFCs that Built the Internet Py-x-Protobuf - Or How I Learned to Stop Worrying and Love Protocol Buffers Python Reverse a List New Beginnings Leaving ChainSafe Systems Screen Lock for Cinnamon Desktop using Zenity and Terminal Commands Crews Not Teams A System for Getting Better at LeetCode
TIL: GitHubtop Real-time Activity Monitor and GoAccess We...
2021-02-16 · via Stonecharioteer on Tech

ghtop - Real-time GitHub Activity Monitor

GitHub - nat/ghtop: See what’s happening on GitHub in real time

Terminal-based tool for monitoring GitHub activity in real-time:

What It Does:

  • Live Activity: Real-time stream of GitHub events
  • API Consumption: Helpful for using up GitHub API quota quickly
  • Terminal Interface: htop-style display for GitHub events
  • Event Filtering: Focus on specific types of GitHub activity

Key Features:

Event Types Monitored:

  • Push Events: Code commits to repositories
  • Pull Requests: PR creation, updates, merges
  • Issues: Issue creation, comments, closures
  • Releases: New releases and tags
  • Forks: Repository forks
  • Stars: Repository stars and watches

Display Information:

User          Repository         Event Type    Time
alice         awesome-project    PushEvent     2s ago
bob           cool-tool         IssuesEvent    5s ago
charlie       web-framework     ForkEvent     8s ago
diana         data-viz          ReleaseEvent  12s ago

Use Cases:

API Quota Management:

  • Testing: Quickly consume API rate limits for testing
  • Development: Understand API usage patterns
  • Monitoring: Track when rate limits reset
  • Debugging: Test API error handling
  • Trending Activity: See what’s active on GitHub right now
  • Development Patterns: Understand when developers are most active
  • Project Monitoring: Watch for activity on specific projects
  • Language Trends: Observe which languages are being used

Educational Value:

  • GitHub API: Learn about GitHub’s event API structure
  • Real-time Data: Understand streaming data concepts
  • Rate Limiting: Experience API rate limiting firsthand

Installation and Usage:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Installation
npm install -g ghtop

# Basic usage
ghtop

# With API token for higher rate limits
GITHUB_TOKEN=your_token ghtop

# Filter by event type
ghtop --filter=PushEvent

GoAccess - Visual Web Log Analyzer

Real-time web log analyzer and interactive viewer:

Core Capabilities:

Log Format Support:

  • Apache: Common and combined log formats
  • Nginx: Standard and custom log formats
  • IIS: Microsoft web server logs
  • Amazon S3: S3 access logs
  • CloudFlare: CDN access logs
  • Custom Formats: Define your own log patterns

Real-time Analysis:

1
2
3
4
5
6
7
8
# Real-time monitoring
tail -f /var/log/nginx/access.log | goaccess -

# Generate HTML report
goaccess /var/log/nginx/access.log -o report.html

# Real-time HTML dashboard
goaccess /var/log/nginx/access.log -o report.html --real-time-html

Rich Analytics Dashboard:

Traffic Metrics:

  • Unique Visitors: Daily unique IP addresses
  • Requested Files: Most popular pages and resources
  • Static Requests: CSS, JS, images analytics
  • 404 Errors: Broken links and missing resources
  • Hosts: Top visitor IP addresses and domains

Detailed Reports:

Top Requested Files
┌─────────────────────────────────────────────────────┐
│ /index.html              │ 1,234 │ 15.2% │ 2.1 MB  │
│ /api/users               │   987 │ 12.1% │ 890 KB  │
│ /static/app.js           │   756 │  9.3% │ 1.5 MB  │
│ /login                   │   654 │  8.0% │ 234 KB  │
└─────────────────────────────────────────────────────┘

Operating Systems
┌─────────────────────────────────────────────────────┐
│ Linux                    │ 2,345 │ 45.6% │         │
│ Windows                  │ 1,876 │ 36.5% │         │
│ macOS                    │   789 │ 15.3% │         │
│ Unknown                  │   134 │  2.6% │         │
└─────────────────────────────────────────────────────┘

Advanced Features:

GeoIP Integration:

1
2
3
4
5
# Install GeoIP database
sudo apt-get install geoip-database

# Enable geographic reporting
goaccess --geoip-database=/usr/share/GeoIP/GeoIP.dat

Geographic Analytics:

  • Countries: Visitor distribution by country
  • Cities: Top cities accessing your site
  • Maps: Visual geographic representation
  • Timezone Analysis: Traffic patterns by timezone

Custom Log Formats:

1
2
3
4
5
6
7
8
9
# Define custom nginx format
goaccess --log-format='%h %^[%d:%t %^] "%r" %s %b "%R" "%u"' \
         --date-format='%d/%b/%Y' \
         --time-format='%T'

# Complex format with custom fields
goaccess --log-format='%h %^ %^ [%d:%t %^] "%r" %s %b "%R" "%u" %D %T' \
         --date-format='%d/%b/%Y' \
         --time-format='%T'

Interactive HTML Dashboard:

  • Real-time Updates: Live data streaming
  • Responsive Design: Mobile-friendly interface
  • Interactive Charts: Clickable graphs and tables
  • Export Options: PDF, CSV, JSON export capabilities

Performance Optimization:

Large Log Files:

1
2
3
4
5
6
7
8
# Use --no-global-config for better performance
goaccess --no-global-config /var/log/nginx/*.log

# Process compressed logs
zcat /var/log/nginx/*.gz | goaccess -

# Multiple log files
goaccess /var/log/nginx/access.log.* --log-format=COMBINED

Memory Management:

  • Streaming Mode: Process logs without loading entirely into memory
  • Incremental Updates: Add new log entries to existing reports
  • Disk Storage: Store data structures on disk for large datasets

Integration and Automation:

Automated Reporting:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/bash
# Daily report generation
goaccess /var/log/nginx/access.log \
    --log-format=COMBINED \
    --output-format=html \
    --output=/var/www/html/stats/daily-$(date +%Y%m%d).html

# Email reports
goaccess /var/log/nginx/access.log \
    --log-format=COMBINED \
    --output-format=csv | \
    mail -s "Daily Website Stats" [email protected]

CI/CD Integration:

  • Performance Monitoring: Track site performance over time
  • Traffic Analysis: Understand user behavior patterns
  • Security Monitoring: Detect unusual access patterns
  • Capacity Planning: Analyze traffic growth trends

Configuration Options:

Color Schemes:

1
2
3
4
5
# Dark theme
goaccess --color-scheme=2

# Custom colors
goaccess --html-custom-css=styles.css

Filtering:

1
2
3
4
5
6
7
8
# Exclude specific IPs
goaccess --exclude-ip=192.168.1.1

# Include only specific paths
goaccess --ignore-panel=KEYPHRASES,REFERERS

# Date range filtering
goaccess --date-spec=hr  # Hourly breakdown

Both tools provide valuable insights into different aspects of software development and web operations - real-time GitHub activity monitoring and comprehensive web traffic analysis.