Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:49:56+00:00 2026-06-08T17:49:56+00:00

I have a Apache access.log file, which is around 35GB in size. Grepping through

  • 0

I have a Apache access.log file, which is around 35GB in size. Grepping through it is not an option any more, without waiting a great deal.

I wanted to split it in many small files, by using date as splitting criteria.

Date is in format [15/Oct/2011:12:02:02 +0000]. Any idea how could I do it using only bash scripting, standard text manipulation programs (grep, awk, sed, and likes), piping and redirection?

Input file name is access.log. I’d like output files to have format such as access.apache.15_Oct_2011.log (that would do the trick, although not nice when sorting.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:49:57+00:00Added an answer on June 8, 2026 at 5:49 pm

    One way using awk:

    awk 'BEGIN {
        split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ", months, " ")
        for (a = 1; a <= 12; a++)
            m[months[a]] = sprintf("%02d", a)
    }
    {
        split($4,array,"[:/]")
        year = array[3]
        month = m[array[2]]
    
        print > FILENAME"-"year"_"month".txt"
    }' incendiary.ws-2009
    

    This will output files like:

    incendiary.ws-2010-2010_04.txt
    incendiary.ws-2010-2010_05.txt
    incendiary.ws-2010-2010_06.txt
    incendiary.ws-2010-2010_07.txt
    

    Against a 150 MB log file, the answer by chepner took 70 seconds on an 3.4 GHz 8 Core Xeon E31270, while this method took 5 seconds.

    Original inspiration: “How to split existing apache logfile by month?“

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the apache server installation I have a .conf file which forwards all requests
I have 51 GB of HTTP (Apache) access logs for my website going back
We have an application deployed on tomcat. To access application we are using apache
I would like to enable SOAP on my PHP5/Centos/Apache server. I have full access
How might one use the ip and timestamp from Apache's access log to approximate
I have a requirement of parsing both Apache access logs and tomcat logs one
I have an Apache server configured with several configuration files in which I declare
I have apache access logs that contain cookie information per request. Can I feed
I have Apache set up through xampp to test a webpage to load some
I have apache httpd that I want to proxy to two different tomcat servers.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.