Zip IIS log files

I have a folder with a number of IIS Logs. I would like to zip and archive the IIS logs but when I zip and archive, I do not want to store everything in 1 zip folder. As a matter of fact, I would like to create 1 zip folder per log and want the folder to have
the same basename as the log file.
I am trying to use this function to achieve what I want:
function add-zip{
param($source, $destination)
$name = Get-ChildItem $source | Select-Object basename
foreach($obj in $name)
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
$zipfilename = $destination + "\" + $obj.BaseName + ".zip"
[System.IO.Compression.ZipFile]::CreateFromDirectory("$source\$name",
$zipfilename, $compressionLevel, $false)
Using the function, I was able to get the zip folders to have the same name as the IIS logs themselves. However, all the zip files present at the source folder got copied inside every zip folder. How do I make sure that every zip folder only gets 1 log file?
I would appreciate the help.
Thanks

Since System.IO.Compression.ZipFile now looks to the entire directory $name, changing it to file would make a zip file foreach $obj, containing
only the IIS log $obj rather than the whole directory $name
[System.IO.Compression.ZipFile]::CreateEntryFromFile("$source\$name\$obj",$zipfilename, $compressionLevel, $false)

Similar Messages

  • CR2008  Cannot report on IIS Log file data source

    I have CR2008 (SP0) and CRXIR2 installed on a Vista desktop.   I can create reports against IIS Log files using XIR2.   When I attempt to make the data connection using CR2008, I go through the same dialog to select log files and dates but at the end it displays "no items found" and I have no table connection that I can add to the report.
    My primary source is IIS 6 log files on a server using a mapped drive.  I have also tried the same using local IIS 7 on the same Vista pc that Crystal is installed on and neither work using CR2008;  both work fine from CRXIR2.
    I also opened from CR2008 an IIS log report created in CRXIR2 and oddly the report runs from 2008 but I cannot modify the data connection as I again just receive "no items found" if I attempt to establish another connection.
    I've tried a re-install and I've confirmed in Crystal setup that I have installed Web Activity Logs as Data source.

    Hi there,
    Try the following:
    1.  Connect to directory of where your IIS server that contains the log file.  It should be in C:\Windows\system32\LogFiles\W3SVC1
    (Or alternatively, I should suggest copying one of these files over locally to your workstation to test.  The file should be in the format of ex*.log)
    2.  Open up CR2008, and do a "Create New Connection"
    3.  Then choose "More Data Sources" -> "MS IIS/Proxy Log Files"
    4.  Point to where your logfile is, whether locally or remotely on the server. 
    5.  A "Select Log Files and Dates" window should appear
    6.  Under "Enter Log File Format and Location" panel (at the top), choose "Extend (ex*.log)" format
    7.  Browse to the file that you would to report off.

  • Changing IIS log file rollover period

    Hi,
    I have a question that I hope that someone could help me with.
    I have an Azure Cloud service running a web role. I want to change the IIS access log file rollover from hourly to daily. The way I approach this is to create a Startup task in this way:
    <Startup>
    <Task commandLine="Startup\Startup.cmd" executionContext="elevated">
    <Environment>
    <Variable name="CurrentInstanceId">
    <RoleInstanceValue xpath="/RoleEnvironment/CurrentInstance/@id" />
    </Variable>
    </Environment>
    </Task>
    </Startup>
    In Startup.cmd, I then have the following code:
    setlocal
    rem Set IIS Log File Rollover to daily
    %systemroot%\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/sites /[name='%CurrentInstanceId%_Web'].logFile.period:"Daily"
    This seems like a fairly straightforward approach, but it doesn't work. The cloud services will not start when published with this command in Startup.cmd. My guess is that the web site isn't properly set up in IIS when the script is run, or that changing
    this setting restarts the site, triggering the script to run again.
    If anyone has any smart ideas about how I should solve my issue?
    BR,
    Per

    Hi,
    From my experience, we can RDP to one cloud service instance to check the iis to ensure the web site and the iis configuration, about how to use startup Configure IIS Components in Windows Azure, please refer to
    http://msdn.microsoft.com/en-us/library/gg433059.aspx for more information.
    Hope this helps
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Move IIS Log files to AWS S3 Bucket...

    I'm seeking to automate a process that will copy or move IIS logs to a remote location.
    The following variables must be taken into account =
    1. Copy or Move all IIS logs (xcopy?) to another location. (Each server maintains several websites)
    2. Delete the existing log files up to the current day log file from each website/ server (free up disk space)
    3. I need to retain the last 2 current days of logs per site / per server.
    4.I'd like to be able to schedule this task per server.
    5. This will be performed on several IIS web servers.
    6. The logs will need to move into their respective folders within the remote location or as part of the process create a new folder name, confirm the copy/move of the logs and location.
    7. I don't have to worry about retaining actual website paths from the servers as long as the log files are in the folders names which are labeled by //server name / website (W3SVC1, W3SVC4, W3SVC5, etc...)
    8. End goal - scheduling an automated task that moves these logs into an AWS S3 location (amazon Storage bucket).
    Thank you.
    LRod

    Hi,
    Okay, so what's your question? All I see up there is a list of requirements (note that we don't write
    scripts on demand here).
    My initial recommendation will be to look into using robocopy as a starting point:
    http://ss64.com/nt/robocopy.html
    Don't retire TechNet! -
    (Don't give up yet - 12,830+ strong and growing)

  • Can I append to IIS log files with jsp?

    When we added a load balancer, our IIS logs started using its IP address in the logfile and not the client's real IP address.
    I need to add the client's real address back into the IIS logs, so our
    reports can restart having the correct session numbers.
    Does anyone know how to do this in JSP?
    I've found snippets of code that says it does this, but I'm not sure where to put the code.
    <% Response.AppendToLog "client_IP" %>
    I tried putting this in my .jsp file and it doesn't know about Response.
    I find reference to Response in the asp API, but not in the jsp API.
    AppendToLog appends this data to the URI Query field of the IIS Log.
    We are using IIS5.0.
    Sue Damitz

    Hi Jonny,
    I don't think it can be done the way you've suggested, however you can accomplish the same thing in a different way.
    Go to System Preferences > Security > General and select 'Require Password Immediately after sleep or screensaver begins'
    Then go into Energy Saver and set your Display sleep to 1 min OR go to Desktop and Screensaver and set the screensaver time to 3 mins.
    That way, once your display goes to sleep or into screen saver it will require a password to resume. This will keep the music playing in the background and also has the added benefit of displaying iTunes album artwork as the screensaver (if that's the screensaver you have selected!)

  • Need Help - IIS Web Server Log Files

    Hi - We run a java applet on our web site and it runs fine. The problem is that in our log files we get hammered with this 404 error all the time.
    Can't find ConsultScrollBeanInfo.class
    The software maker says it is a bug with Java 2 SDK.
    If this is true, is there a fix so that IIS log files wont pick this up any more?
    Thanks!

    Hi Patrick, 
    I would suggest having the log file checkbox enabled in the target options.  That should show if errors are occurring while it is running. Are you running remote front panels and web services, or just remote front panels?
    Can you provide a picture of all the software you have installed on your PXI?  You should be able to find this in MAX under the PXI in Remote Systems.
    Scott A
    SSP Product Manager
    National Instruments

  • File system task - Move file issue, skip the current log file thats open by another process - IIS logs

    Hi,
    I have created a package to move IIS log files from their source directory to another directory called processing. However, when the package tries to move the current log file it errors because the file is in use by another process (by IIS as its still writing
    to it). I would like the package to just ignore the "in-use" file and process the rest and show the package completing successfully. The file in use will be rolled by IIS at midnight and the file will be picked up by the next package run.
    However, when the file is rolled and becomes free a new log file is created which will be marked as "in-use"...... which should be ignored at the next run.
    Is there some way that I can tell the file system task to ignore in use files or add an event handler to do the same sort of thing?
    Any assistance is appreciated

    Hi Arthur,
    Thank you for your reply.
    I have resolved the issue with the following example:
    http://www.timmitchell.net/post/2010/08/23/ssis-conditional-file-processing-in-a-foreach-loop/
    What I realised was that I needed to just ignore the current log file which gets created daily, so using the above example (and changing the last written date to created date) I am able to ignore/skip the log thats in use.
    Adam

  • Design a report off a log file

    Crystal reports version XI
    I would like to design  a report off a log file (with .log extention).
    How would i go about it? (like data source etc)
    Any input iappreciated.
    Thanks in advance, padie

    Following SAP note could be useful too:
    Follow the link below:
    https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_ossnotes&query=proxies&adv=false&sortby=cm_rnd_rankvalue&start=1&sortmode=true
    and search for SAP note "1213781 - How to generate a report based on Internet Information Server (IIS) log files"

  • MOSS 2007 IIS logs on our servers are consuming large spaces on drive.

    Hi,
    our IIS logs are filled up with large memory and i  am trying to minimize iis logging log files size.
    Can someone please help me with the solution to minimize iis log files size.
    Thanks.
    Badri

    Hi Sanjeev,
    Did these users use IE10 to access SharePoint 2007?
    If yes, you can try to set the IE10 browser-> F12-> User Agent->Internet Explorer 8, see if the it could work, if it's the case, the issue is caused by the .NET 2.0 itself, you can try the hotfix mentioned in the following articles for your server,
    then check results again.
    http://gigajim.com/blog/2012/12/11/sharepoint-2010-and-ie10-incompatibility
    http://www.hanselman.com/blog/BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx
    Thanks,
    Daniel Yang
    Forum Support
    If you have feedback for TechNet Subscriber Support, contact [email protected]
    Daniel Yang
    TechNet Community Support

  • Setting IIS W3C Extended Log File settings via command line, registry or configuration file

    I am currently in need of a way to set IIS W3C Extended Log File settings via command line, registry or configuration file.  More specifically the 'Bytes Sent (sc-bytes)' and 'Bytes Received (cs-bytes)' settings that are not enabled by default. 
    If anyone knows where I can locate these setting (outside of the GUI) for all IIS versions that would be greatly appreciated.

    I believe I have found a valid solution. You must have the WebAdministration module loaded.  I hope this helps someone.
    Use the following syntax to view current W3C fields:
    Get-WebConfiguration -filter system.applicationhost/sites/sitedefaults/logfile | select-object -expandProperty logExtFileFlags
    Use the following syntax to set W3C fields:
    Set-WebConfigurationProperty -Filter System.Applicationhost/Sites/SiteDefaults/logfile -Name LogExtFileFlags -Value "Date,Time,ClientIP,UserName,SiteName,ComputerName,ServerIP,Method,UriStem,UriQuery,HttpStatus,Win32Status,BytesSent,BytesRecv,TimeTaken,ServerPort,UserAgent,Cookie,Referer,ProtocolVersion,Host,HttpSubStatus"}

  • How to delete log file after zipping in batch

        
        **please check my code ... and suggest any changes to be made ... i m able to zipp the logs but not able to delete those logs.........
            thanking you...
            this is my code....
            @echo off
            set zip="C:\Program Files\7-Zip\7z.exe"
            rem Findout Month, Year and Date
            FOR /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do set year=%%D
            FOR /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do set month=%%B
            FOR /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do set day=%%C
            rem Solve problem Year start and adding 0 in month
            if %month% EQU 01 (
            set month=12
            set /a year=%year%-1
            ) else (
            set /a month=%month%-1
            if %month% LSS 10 set month=0%month%
            rem Set file names for last month file.
            set lastmonthfiles=server.log.%year%-%month%-
            %zip% -tzip  a -y "%lastmonthfiles%.zip" %lastmonthfiles%*
            if exist %lastmonthfiles%.zip(
            DEL server.log.%year%-%month%-*
            ) else (
                echo file not found
                pause

    Actually it is only the 7Z filemanager that can delete files using the "Move" command and the "Delete after archiving" option.
    if EXIST %lastmonthfiles%.zip ( DEL server.log.%year%-%month%-* ) ELSE echo zip not found
    ¯\_(ツ)_/¯

  • Parse a log file...

    Hi All,
    1. I want to parse the content of log file, but when I open the log file it does not show me field names .
    it starts with row containing the contents directly, where i want to read and process only three fields randomly.
    I have written the code that works on IIS logs, the log i want to parse having field separator ' ' as single white space.
    2. Some of log files are zipped, so I am unable to open and read them. so that I can parse them.
    can any one have any clue or code that help me out.
    thanks!

    bhatnagarudit wrote:
    Hi All,
    1. I want to parse the content of log file, but when I open the log file it does not show me field names .
    it starts with row containing the contents directly, where i want to read and process only three fields randomly.
    I have written the code that works on IIS logs, the log i want to parse having field separator ' ' as single white space.
    2. Some of log files are zipped, so I am unable to open and read them. so that I can parse them.
    can any one have any clue or code that help me out.
    thanks! Here is a suggested algorithm .. (I don't want to write the code for you :-))
    You have the following format.
    314159b66967d86f031c7249d1d9a8024.. mybucket +[04/Aug/2006:22:34:02 +0000]+ 72.21.206.5 314159b66967d86f031c724... 3E57427F33A59F07 REST.PUT.OBJECT* /photos/2006/08/puppy.jpg +"GET /mybucket/photos/2006/08/puppy.jpg?x-foo=bar"+ 200 NoSuchBucket 2662992 3462992 70 10 "http://www.amazon.com/webservices" "curl/7.15.1"
    Read the file in, go thru lines one by one. For each line,
    1. Get the content in the first square brackets. Regular Expression: [&].
    2. From there, get the fourth (4th) word separated by space.
    3. From there, get the content in the first pair of double quotes. Regular Expression: \"&\".

  • How to read Skype connection logs (.log files in /...

    Hi all,
    A funny problem but really important - please help!
    I set up logging to find out causes of some tech problems occuring during my calls, as it described here: https://support.skype.com/en/faq/FA12321/how-do-i-create-log-files
    So, I get now /Logs folder with .log files.
    But they are not text files and I don't know what this format is and what tool can read them(
    Skype tech support doesn't know as well. Please help, who knows, how to read these .log files?
    Thanks!
    ps my OS is Ubuntu Linux

    It's somewhat odd that the Skype tech support staffer you spoke with doesn't know what to do with the logs, as the instructions you posted say to place them in a ZIP file and sent it to them. Since the log files I observed start with 'BLOGBEGIN,' there must be software to parse the file. Also...you never described the tech problems during calls which prompted you to enable logging; and if Skype Support suggested it (which seems doubtful, given they didn't know what to do with the files). Perhaps you can provide a description of the issue?

  • How can I save my Log files (and other my own files) to windows azure ?

    Hi ,Dear all
    I am migrating an Asp.Net Web App to Windows Azure. It runs in IIS
    In that Web App,it will:
      1. save log files to a virtual path (for example, save to $WEBAPP_ROOT_DIR/LOGFILES/
      2. save ViewState by session as temporary files to a virtual path (for example , save to $WEBAPP_ROOT_DIR/VIEWSTATE/
      3. upload some image files to the web server virtual path at $WEBAPP_ROOT_DIR/UPLOAD/
    so, when I migrate the web app to windows azure,how can I do the same job in my code?It seems so many great changes in my code ...
    Any ideas and suggestions for me ? many thanks!

    hi Eric,
    If you use Azure website, you can save your log and files into azure storage service ,such as blob or table.
    If you use VM to host your service, you can only attach a data disk or file service on your VM and save your data into data disk or file service.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Collecting Log Files

    When providing feedback around reported issues we may request you access and share certain log files from your computer in order to better understand the operation of the Creative Cloud app on your system.
    Below is information about various log files, their location, and when they are created.
    Note: (Windows) If unable to locate a specific folder it may be necessary to ensure the option to show hidden folders is turned on
    http://helpx.adobe.com/x-productkb/global/show-hidden-files-folders-extensions.html
    Note: (Mac) The Users Library user folder is hidden on starting with 10.7 or later
    see http://helpx.adobe.com/x-productkb/global/access-hidden-user-library-files.html
    ~ on Mac denotes the logged in user's directory.  The Library folder under it is hidden. The easiest way to access it is to use the "Go to folder" option from the "Go" menu of Finder and type the path exactly as I typed starting from ~ symbol.)
    Please always include these logs - PDApp.log and AMT3.log from this location:
        Win7/8 : %TEMP%
        Mac : ~/Library/Logs/
    For issues with installation - include these log files:
        Win: <drive>:\Program Files\Common Files\Adobe\Installers
        Mac: /Library/Logs/Adobe/Installers
    For issues with updates
        Win7/8: <%localappdata%>\Adobe\AAMUpdater\1.0
        Mac: ~/Library/Application Support/Adobe/AAMUpdater/1.0
    Please zip this complete 1.0 folder to share
    For issues with activation or licensing
    Please zip the entire SLCache folder and all files in it, into a single zip, and attach to bug)
        Windows 32 bit: <drive>:\Program Files\Common Files\Adobe
        Windows 64 bit: <drive>:\Program Files (x86)\Common Files\Adobe
        Mac: ~/Library/Application Support/Adobe
    For issues with Adobe Application Manager and downloading
        Windows: %temp%[AdobeDownloads]\
        Mac: ~/Library/Logs/Adobe/AdobeDownloads/
    For issues related to file sync and Typekit
    Mac:
    The log file can be found here:
    <Mac Hard Drive>/Users/<username>/Library/Application Support/Adobe/CloudSync/CoreSync-YYYY-MM-DD.log
    (where YYYY-MM-DD indicate the date of the last log)
    Please see note at the top about for accessing the user library folder
    Windows:
    The log file can be found here:
    C:\Users\<username>\AppData\Roaming\CloudSync\CoreSync-YYYY-MM-DD.log
    (where YYYY-MM-DD indicate the date of the last log)

    I am able to run the commands individually from oracle user, but when I run "raccheck" script its not working.
    oracle & grid user id:_
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ id oracle
    uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),504(asmdba),506(oper)
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ id grid
    uid=502(grid) gid=501(oinstall) groups=501(oinstall),503(asmadmin),504(asmdba),505(asmoper)
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$I am able to run crsctl command or any other GI command from oracle user. But "raccheck" script is not working.
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ echo $CRS_HOME
    /app/grid/product/11.2.0.3
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ $CRS_HOME/bin/crsctl query crs activeversion
    Oracle Clusterware active version on the cluster is [11.2.0.3.0]
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ $CRS_HOME/bin/crsctl query crs softwareversion
    Oracle Clusterware version on node [hublpr1] is [11.2.0.3.0]
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ $CRS_HOME/bin/crsctl check crs
    CRS-4638: Oracle High Availability Services is online
    CRS-4537: Cluster Ready Services is online
    CRS-4529: Cluster Synchronization Services is online
    CRS-4533: Event Manager is online
    oracle@hublpr1:/admintmp/ORACLE/RAC-Check$ cat /proc/cpuinfo
    processor       : 0
    vendor_id       : GenuineIntel
    cpu family      : 6
    model           : 44
    ...................................................

Maybe you are looking for

  • My ipod broke, can i transfer songs from hard drive to another ipod or comp

    Yea just like the topic says, my ipod's screen broke but the harddrive is still good and i have another ipod video 30 GB, is it possible for me to transfer the old ipod's files into the new ipod? I know how to open it and all but i dont know if the n

  • Abap oo concepts

    Hi, I have used this code in my prog.I got "Cref is not an object reference" error..how to rectify it..please help if u know... data:cref type ref to c1. create object cref.

  • [SOLVED] Safe way to replace supporting package

    Im trying to upgrade "gdrivefs" package from AUR where dependency "fusepy" is replaced to "python2-fusepy-git". Upgrade fails because "python2-fusepy-git" conflicts with "fusepy" - they share same file. Uninstallig of "fusepy" is tricky, because it i

  • Why Statement doesn't work?

    In my jsp page,I wrote: <%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection conn=DriverManager.getConnection("jdbc:microsoft:sqlserver://CE800:1181;DatabaseName=supermarket;user=sa;Password="); Statement stmt=conn.CreateStatem

  • Problem on "error: modeler error: model error" by using wscompile

    When I use wscompile to generate the client stub, I get the follwoing error: error: modeler error: model error: invalid entity name: "BaseFaultType" (in name space: "http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-BaseFaults-1.2-draft-01.xsd") What i