refresh
This commit is contained in:
parent
8e9c0593fb
commit
8f56cbd5c8
4 changed files with 6 additions and 8 deletions
1
README
1
README
|
|
@ -1,5 +1,4 @@
|
|||
# geolog
|
||||
Tool to monitor the internet backgroung radiation.
|
||||
|
||||
|
||||
This readme is still to be done.
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ def load_logs_binary(service: Optional[str], start: Optional[str], end: Optional
|
|||
end_dt = pd.to_datetime(end) if end else None
|
||||
records = []
|
||||
|
||||
with open("access.log", "r", errors="ignore") as f:
|
||||
with open("file.log", "r", errors="ignore") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
start_idx = find_line_index(lines, start_dt, seek_start=True) if start_dt else 0
|
||||
|
|
@ -115,7 +115,6 @@ def load_logs_binary(service: Optional[str], start: Optional[str], end: Optional
|
|||
continue
|
||||
records.append({
|
||||
"timestamp": ts.isoformat(),
|
||||
"ip": ip,
|
||||
"path": path,
|
||||
"lat": lat,
|
||||
"lon": lon
|
||||
|
|
@ -141,7 +140,7 @@ def get_connections(
|
|||
# ----------------------------
|
||||
@app.get("/health")
|
||||
def health():
|
||||
size = os.path.getsize("access.log")
|
||||
size = os.path.getsize("file.log")
|
||||
return {"status": "ok", "log_size_bytes": size, "cached_ips": len(geo_cache)}
|
||||
|
||||
# ----------------------------
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
||||
<script>
|
||||
const OUR_COORDS = [37.7749, -122.4194];
|
||||
const OUR_COORDS = [46.0660875,11.1501202];
|
||||
const MAP_CENTER = [20, 0];
|
||||
const MAP_ZOOM = 2;
|
||||
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
let simStartMs = 0, simEndMs = 0;
|
||||
|
||||
async function fetchConnections(service, start, end) {
|
||||
let url = `http://localhost:8000/connections?`;
|
||||
let url = `/connections?`;
|
||||
if (service) url += `service=${encodeURIComponent(service)}&`;
|
||||
if (start) url += `start=${new Date(start).toISOString()}&`;
|
||||
if (end) url += `end=${new Date(end).toISOString()}&`;
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
function createMarkerAndArc(conn, visibleTimeMs = 2500) {
|
||||
const lat = conn.lat, lon = conn.lon;
|
||||
const marker = L.circleMarker([lat, lon], { radius: 5, fillOpacity: 0.9 })
|
||||
.bindPopup(`<b>IP:</b> ${conn.ip}<br><b>Service:</b> ${conn.path}<br><b>Time:</b> ${conn.timestamp}`)
|
||||
.bindPopup(`<b>Service:</b> ${conn.path}<br><b>Time:</b> ${conn.timestamp}`)
|
||||
.addTo(markersLayer);
|
||||
|
||||
const arcPoints = computeArcPoints(lat, lon, OUR_COORDS[0], OUR_COORDS[1], 48, 0.18);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from datetime import datetime, timezone
|
|||
import time
|
||||
|
||||
ACCESS_LOG = "/var/log/nginx/access.log"
|
||||
OUTPUT_LOG = "./file.log"
|
||||
OUTPUT_LOG = "/home/proxi/geolog/file.log"
|
||||
|
||||
INTERNAL_NETWORKS = [
|
||||
ipaddress.ip_network("10.0.0.0/8"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue