Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add the /paniclog page, accessible only to administrators. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
11f6b5b06cfd9aaea449a350ee3da31e |
| User & Date: | drh 2024-03-29 13:44:24.764 |
Context
|
2024-03-29
| ||
| 17:37 | Include the MANIFEST_VERSION in the segfault backtrace listing to help the developer chase the issue in the proper binary. check-in: f8580614d0 user: stephan tags: trunk | |
| 13:44 | Add the /paniclog page, accessible only to administrators. check-in: 11f6b5b06c user: drh tags: trunk | |
| 13:15 | Provide the full pathname of the CGI control file when describing how to activate the error log in the errorlog page, and on the security audit. check-in: 4644ebef64 user: drh tags: trunk | |
Changes
Changes to src/security_audit.c.
| ︙ | ︙ | |||
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
**
** Show the content of the error log. Only the administrator can view
** this page.
*/
void errorlog_page(void){
i64 szFile;
FILE *in;
char z[10000];
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Server Error Log");
style_submenu_element("Test", "%R/test-warning");
style_submenu_element("Refresh", "%R/errorlog");
style_submenu_element("Log-Menu", "%R/setup-logmenu");
if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
no_error_log_available();
style_finish_page();
return;
}
if( P("truncate1") && cgi_csrf_safe(2) ){
| > > | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 |
**
** Show the content of the error log. Only the administrator can view
** this page.
*/
void errorlog_page(void){
i64 szFile;
FILE *in;
char *zLog;
char z[10000];
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Server Error Log");
style_submenu_element("Test", "%R/test-warning");
style_submenu_element("Refresh", "%R/errorlog");
style_submenu_element("Log-Menu", "%R/setup-logmenu");
style_submenu_element("Panics", "%R/paniclog");
if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
no_error_log_available();
style_finish_page();
return;
}
if( P("truncate1") && cgi_csrf_safe(2) ){
|
| ︙ | ︙ | |||
826 827 828 829 830 831 832 |
@ <p>Confirm that you want to truncate the %,lld(szFile)-byte error log:
@ <input type="submit" name="truncate1" value="Confirm">
@ <input type="submit" name="cancel" value="Cancel">
@ </form>
style_finish_page();
return;
}
| > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 |
@ <p>Confirm that you want to truncate the %,lld(szFile)-byte error log:
@ <input type="submit" name="truncate1" value="Confirm">
@ <input type="submit" name="cancel" value="Cancel">
@ </form>
style_finish_page();
return;
}
zLog = file_canonical_name_dup(g.zErrlog);
@ <p>The server error log at "%h(zLog)" is %,lld(szFile) bytes in size.
fossil_free(zLog);
style_submenu_element("Download", "%R/errorlog?download");
style_submenu_element("Truncate", "%R/errorlog?truncate");
in = fossil_fopen(g.zErrlog, "rb");
if( in==0 ){
@ <p class='generalError'>Unable to open that file for reading!</p>
style_finish_page();
return;
}
if( szFile>MXSHOWLOG && P("all")==0 ){
@ <form action="%R/errorlog" method="POST">
@ <p>Only the last %,d(MXSHOWLOG) bytes are shown.
@ <input type="submit" name="all" value="Show All">
@ </form>
fseek(in, -MXSHOWLOG, SEEK_END);
}
@ <hr>
@ <pre>
while( fgets(z, sizeof(z), in) ){
@ %h(z)\
}
fclose(in);
@ </pre>
style_finish_page();
}
/*
** WEBPAGE: paniclog
**
** Scan the error log for panics. Show all panic messages, ignoring all
** other error log entries.
*/
void paniclog_page(void){
i64 szFile;
char *zLog;
FILE *in;
int bOutput = 0;
int prevWasTime = 0;
char z[10000];
char zTime[10000];
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_header("Server Panic Log");
style_submenu_element("Log-Menu", "%R/setup-logmenu");
if( g.zErrlog==0 || fossil_strcmp(g.zErrlog,"-")==0 ){
no_error_log_available();
style_finish_page();
return;
}
in = fossil_fopen(g.zErrlog, "rb");
if( in==0 ){
@ <p class='generalError'>Unable to open that file for reading!</p>
style_finish_page();
return;
}
szFile = file_size(g.zErrlog, ExtFILE);
zLog = file_canonical_name_dup(g.zErrlog);
@ Panic messages contained within the %lld(szFile)-byte
@ <a href="%R/errorlog?all">error log</a> found at
@ "%h(zLog)".
fossil_free(zLog);
@ <hr>
@ <pre>
while( fgets(z, sizeof(z), in) ){
if( prevWasTime
&& (strncmp(z,"panic: ", 7)==0 || strstr(z," assertion fault ")!=0)
){
@ %h(zTime)\
bOutput = 1;
}
if( strncmp(z, "--------", 8)==0 ){
size_t n = strlen(z);
memcpy(zTime, z, n+1);
prevWasTime = 1;
bOutput = 0;
}else{
prevWasTime = 0;
}
if( bOutput ){
@ %h(z)\
}
}
fclose(in);
@ </pre>
style_finish_page();
}
|
Changes to src/setup.c.
| ︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
blob_appendf(&desc,"The error log is disabled for this repository.");
}else{
blob_appendf(&desc,"In this repository, the error log is in the file"
"named \"%s\".", g.zErrlog);
}
setup_menu_entry("Error Log", "errorlog", blob_str(&desc));
blob_reset(&desc);
setup_menu_entry("User Log", "user_log",
"The user log is a record of login attempts. The user log is stored\n"
"in the \"accesslog\" table of the respository.\n"
);
@ </table>
| > > > > > > | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
blob_appendf(&desc,"The error log is disabled for this repository.");
}else{
blob_appendf(&desc,"In this repository, the error log is in the file"
"named \"%s\".", g.zErrlog);
}
setup_menu_entry("Error Log", "errorlog", blob_str(&desc));
blob_reset(&desc);
setup_menu_entry("Panic Log", "paniclog",
"The panic log is a filtering of the Error Log that shows only the\n"
"most important messages - assertion faults, segmentation faults, and\n"
"similar malfunctions."
);
setup_menu_entry("User Log", "user_log",
"The user log is a record of login attempts. The user log is stored\n"
"in the \"accesslog\" table of the respository.\n"
);
@ </table>
|
| ︙ | ︙ |