Ysurac / FlightAirMap

Open source project displaying live aircrafts, ships or trackers on 2D/3D map. Browse through the data based on a particular aircraft, airline, airport, tracker or vessel to search through the database or see extensive statistics. Can use ADS-B in SBS1 format (dump1090, Radarcape,...), VRS, VA (VATSIM, IVAO whazzup.txt, phpvms,...), ACARS (acarsdec, acarsdeco2), APRS, AIS as datasource.
https://www.flightairmap.com/
GNU Affero General Public License v3.0
523 stars 158 forks source link

Gigabytes of Excessive Log-Writes to SD-Card #366

Closed TomMuc1 closed 7 years ago

TomMuc1 commented 7 years ago

today by accident looked into log directory of my pi and found that now after about 4 weeks running flightairmap i have more than 3 gigabyte of logfiles /var/log/daemon.log and /var/log/syslog e.g.

i'd say in system service there has to be added that stdout does not write to log ... https://github.com/Ysurac/FlightAirMap/blob/master/install/init/flightairmap.service.systemd

Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: DATA : hex : 3C49EE - ident :  - ICAO : B753 - Departure Airport : NA - Arrival Airport : NA - Latitude : 49.674171 - Longitude : 6.300362 - waypoints :  - Altitude : 350 - Heading : 168 - Speed : 537 - Departure Airport Time :  - Arrival Airport time :  - Source Name : JSON
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: \o/ Add  from aircraftjson in Live DB : -- Delete previous data -- (Add to SBS archive : success)success
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: DATA : hex : 484F6D - ident : TRA425 - ICAO : B738 - Departure Airport : EHAM - Arrival Airport : LGZA - Latitude : 50.940033 - Longitude : 7.975555 - waypoints :  - Altitude : 390 - Heading : 126 - Speed : 542 - Departure Airport Time :  - Arrival Airport time :  - Source Name : JSON
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: \o/ Add TRA425 from aircraftjson in Live DB : -- Delete previous data -- (Not adding to archive)success
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: DATA : hex : 508395 - ident : AUI130 - ICAO : B738 - Departure Airport : LFPG - Arrival Airport : UKBB - Latitude : 49.834946 - Longitude : 7.432901 - waypoints :  - Altitude : 350 - Heading : 75 - Speed : 471 - Departure Airport Time :  - Arrival Airport time :  - Source Name : JSON
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: \o/ Add AUI130 from aircraftjson in Live DB : -- Delete previous data -- (Not adding to archive)success
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: DATA : hex : 495289 - ident : TAP551 - ICAO : A319 - Departure Airport : LPPT - Arrival Airport : LFLL - Latitude : 48.19609 - Longitude : 11.037574 - waypoints :  - Altitude : 206 - Heading : 251 - Speed : 328 - Departure Airport Time :  - Arrival Airport time :  - Source Name : JSON
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: \o/ Add TAP551 from aircraftjson in Live DB : -- Delete previous data -- (Not adding to archive)success
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: DATA : hex : 3C6306 - ident : NLY4VV - ICAO : B737 - Departure Airport : HAJ - Arrival Airport : PMI - Latitude : 49.303345 - Longitude : 8.327144 - waypoints :  - Altitude : 390 - Heading : 194 - Speed : 500 - Departure Airport Time :  - Arrival Airport time :  - Source Name : JSON
Oct 29 06:31:05 RaspPiADSB0 daemon-spotter.php[851]: \o/ Add NLY4VV from aircraftjson in Live DB : -- Delete previous data -- (Not adding to archive)success
Ysurac commented 7 years ago

It's because $globalDebug in require/settings.php is enabled. In latest systemd init I always redirect output to /dev/null, so no more logs.

TomMuc1 commented 7 years ago

ok - but why is debug enabled by default? and weren't it a good idea to set to disabled - this way a simple git pull would solve the problem for most users instead of tinkering again in system service. this bug could really lead to wear-out their sd-cards ...

TomMuc1 commented 7 years ago

the fix you did won't work you have to add 'StandardOutput=null' https://github.com/Ysurac/FlightAirMap/blob/master/install/init/flightairmap.service.systemd

[Unit]
Description=FlightAirMap
Requires=mysql.service
After=mysql.service

[Service]
ExecStart=/bin/bash -c '/var/www/flightairmap/scripts/daemon-spotter.php 2>&1'
Restart=always
RestartSec=10
StandardOutput=null

[Install]
WantedBy=multi-user.target
TomMuc1 commented 7 years ago

made a short howto for the guys on flightaware forum: https://discussions.flightaware.com/t/flightairmap-watching-your-live-data-next-level/26536/47?u=tommuc

cheers tom

Ysurac commented 7 years ago

systemd init fixed. Debug is enabled by default because FlightAirMap is not in a stable version yet. Even if I change default setting, this wouldn't change anything for already installed version: I don't change a setting already set.