473,385 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PHP file to split a log file if size is more

Using "crontab -e", I have to schedule a task everyday.
We have an all time running web application(Java) which produces a log file, appends data into it every time a person accesses the application from the browser.
So, after two or three days, the size of the log file will become huge(for Tomcat server) and it doesn't allow the Tomcat server to run the application.

So I want to split the log file into files of lesser size. I need to put the command to split the log file in the php file and run the php file daily(I will use "crontab -e" and add the command to execute the php script).
Finally the original log file has to be deleted without harming the application.
The file is "catalina.out" which becomes huge and I should check its size. If it is more than 100MB, then I should run the php script to split that file. So anyone please give me the php script for the same. Thank you in advance. :-)
Apr 5 '14 #1
5 1918
Luuk
1,047 Expert 1GB
Are you sure you want to do it this way?

Why not the right way, using logrorate?
see: http://java.dzone.com/articles/how-r...at-catalinaout
Apr 5 '14 #2
Thank you Luuk :-)
I understood that this is better and simple.
It is mentioned to create "tomcat" file under the folder "/etc/logrotate.d/". May I please know the extension of the file named "tomcat"???
Apr 7 '14 #3
Luuk
1,047 Expert 1GB
no extension is needed for the file named 'tomcat'
Apr 11 '14 #4
Thank You Luuk :-) Will try the above and will let you know if any issues...
Apr 15 '14 #5
Where does the rotated log files get placed. Is it on the same directory where the original file resides?
Apr 15 '14 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: REM | last post by:
I have some problems. It's dilemma between BLOB, BFILE and takes care of file on file system. What it's advantage?? I import some PDF document in BLOB filed in my database. It's about 1000...
1
by: Daniel Cardoso | last post by:
I don't know what else to try - In my asp.net app, when the file name has Windows-1252 characters (like ã and ç), these characters appear, each one, as two strange characters in the file name label...
19
by: **Developer** | last post by:
When I get the image from the file the file remains locked so the Delete fails with a "used by another process" So I tried using a clone and disposing the obtained image. But that didn't fix...
10
by: vunet.us | last post by:
What is the workaround of passign a parameter to any included asp file: <!-- #Include File="file.asp" --> This obviously does not work: <!-- #Include File="file.asp?id=123" --> Thank you
4
by: nano2k | last post by:
Hi For some purposes, I need to create a new binary file and to allocate a fixed length for that file on the disk. I need something like File.Create(string fileName, long initialSizeInBytes)....
8
by: raylopez99 | last post by:
I have the latest version of Visual Studio 2008 Professional, which allows you to create resource files (this is the .resx file, no?), unlike the Express version, which does not. I am trying to...
1
by: Man4ish | last post by:
I am trying to create a file of fixed size. I am using setw() e.g. 43 68 + 169161408 115 287 + 169161408 I am using setw() after first column ...
1
by: sumoncse07 | last post by:
how to import csv file to mysql database file size more than 440MB i have a file in text format that need to be import to the database i can easily upload if the file size is less than 2MB.the...
2
by: slsv | last post by:
Hi, I'm not very familiar how to do this in C#. Need to connect to Oracle db, take a file from directory then read every line of the file. Lines are like this: ...
1
by: nNaveenpal | last post by:
how to validate input type file using javascript for file type and size?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.