A lightweight, standalone diagnostic tool for logging Cursor on Target (CoT) messages from TAK servers.
cotlogger is a purpose-built tool that connects to Team Awareness Kit (TAK) servers and captures all CoT message traffic in real-time. It's designed for network diagnostics, traffic analysis, debugging, and operational monitoring of TAK environments.
- π Multiple Connection Modes: TCP and SSL/TLS support
- π¦ Embedded Certificates: Bundle certs directly in binary for zero-config deployment
- π Multiple Output Formats: Human-readable, raw, and JSON formats
- β‘ Real-time Logging: Immediate disk writes with automatic flushing
- π Auto-Reconnection: Robust connection handling with configurable retry intervals
- π‘οΈ Production Ready: Thread-safe, graceful shutdown, comprehensive error handling
- π Zero Dependencies: Uses only Go standard library
# Clone and build
git clone https://github.com/NERVsystems/cotlogger.git
cd cotlogger
go build
# Basic usage - TCP connection
./cotlogger -host your-tak-server.com -port 8089 > messages.log
# Stream directly to stdout
./cotlogger -host your-tak-server.com -port 8089
# SSL connection with certificates
./cotlogger -host secure-tak.mil -protocol ssl -cert client.crt -key client.key -ca ca.crt > secure-messages.log
# JSON output for analysis tools
./cotlogger -format json > data.jsonAfter connecting, cotlogger sends <takserver><subscribe>event</subscribe></takserver> to request the event stream. Some servers expect a simpler <hello/> message. Use the -handshake flag to change this if needed.
git clone https://github.com/NERVsystems/cotlogger.git
cd cotlogger
go build -o cotloggergo build -ldflags "-X main.version=$(git describe --tags)" -o cotloggermake build # Local build
make build-all # Cross-platform builds
make install # Install to /usr/local/bin./cotlogger -host tak.example.com -port 8089 -verbose > messages.log./cotlogger \
-host secure-tak.mil \
-protocol ssl \
-cert /path/to/client.crt \
-key /path/to/client.key \
-ca /path/to/ca.crt \
> secure-messages.log./cotlogger -format json -verbose > cot-data.json./cotlogger \
-host production-tak.mil \
-protocol ssl \
-embedded-certs \
-format raw \
> /var/log/tak/cot-$(date +%Y%m%d).log \
-reconnect 5s| Flag | Default | Description |
|---|---|---|
-host |
localhost |
TAK server hostname |
-port |
8089 |
TAK server port |
-protocol |
tcp |
Connection protocol (tcp or ssl) |
-embedded-certs |
false |
Use embedded certificates |
-cert |
Client certificate file (SSL mode) | |
-key |
Client private key file (SSL mode) | |
-ca |
CA certificate file (SSL mode) | |
-format |
formatted |
Output format (raw, formatted, json) |
-reconnect |
30s |
Reconnection interval |
-read-timeout |
30s |
Socket read timeout |
-write-timeout |
30s |
Socket write timeout |
-handshake |
<takserver><subscribe>event</subscribe></takserver> |
Initial subscription message |
-verbose |
false |
Enable verbose logging |
-version |
false |
Show version information |
Human-readable format with clear timestamps and XML formatting:
=== 2025-01-30T15:08:22Z - INCOMING ===
<?xml version="1.0" encoding="UTF-8"?>
<event version="2.0" uid="ANDROID-abc123" type="a-f-G-U-C" how="m-g" time="2025-01-30T15:08:22Z">
<point lat="19.87145" lon="99.821362" hae="365.443"/>
<detail>
<contact callsign="BRAVO-6" endpoint="*:-1:stcp"/>
</detail>
</event>
Pipe-delimited format optimized for parsing and analysis:
2025-01-30T15:08:22Z|<?xml version="1.0"?><event version="2.0" uid="ANDROID-abc123"...
Structured JSON format for programmatic analysis:
{"timestamp":"2025-01-30T15:08:22Z","message":"<?xml version=\"1.0\"?><event..."}For zero-config deployment, embed certificates directly in the binary:
- Edit
main.goand replace the certificate constants:
const (
embeddedCert = `-----BEGIN CERTIFICATE-----
MIIFoTCCA4mgAwIBAgIUJ1...your-actual-certificate...
-----END CERTIFICATE-----`
embeddedKey = `-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w...your-actual-private-key...
-----END PRIVATE KEY-----`
embeddedCA = `-----BEGIN CERTIFICATE-----
MIIFdTCCA12gAwIBAgIUK2...your-actual-ca-cert...
-----END CERTIFICATE-----`
)- Build and deploy:
go build -o cotlogger-embedded
./cotlogger-embedded -host tak.server.mil -protocol ssl -embedded-certs- Certificate Validation: Performs full certificate chain validation in SSL mode
- Hostname Verification: Skipped for development flexibility (configurable)
- File Permissions: Creates logs with 0644, directories with 0755 permissions
- Embedded Certs: Keep binaries secure and rotate certificates regularly
- Network Security: Always use SSL mode in production environments
- Real-time Logging: Messages are immediately written and flushed to disk
- Memory Efficient: ~8KB buffer size, minimal memory footprint
- Connection Resilience: Automatic reconnection with configurable backoff
- Graceful Shutdown: Clean resource cleanup on SIGINT/SIGTERM
- Thread Safety: Concurrent-safe message logging with proper mutex protection
- Structured Logging: Built-in slog integration for operational visibility
Monitor TAK traffic patterns, connection issues, and message flow:
./cotlogger -verbose -read-timeout 5s -reconnect 5sCapture traffic for security auditing and threat analysis:
./cotlogger -format json > audit-$(date +%Y%m%d).jsonMonitor high-volume environments:
./cotlogger -format raw -verbose > perf-test.logDebug TAK integrations and protocol issues:
./cotlogger -host localhost -protocol tcp -format formatted -verbosemake build # Current platform
make build-all # Linux, macOS, Windows
make build-linux # Linux AMD64
make build-darwin # macOS AMD64/ARM64
make build-windows # Windows AMD64
make clean # Clean artifacts
make install # Install to system PATH- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs and feature requests via GitHub Issues
- Documentation: See the
docs/directory for detailed documentation - Examples: Check the
examples/directory for usage examples
- nerv-tak - AI-powered TAK assistant (where this tool originated)
- TAK Server - Official TAK Server documentation