Refine your search:

Hi all,

I would like to export logs (in raw format) periodically, eg. everyday or every week. I managed to do this by writing a shell script using the export command.

The thing which I don't like about this command is that every time the export command is run, all the indexed logs are exported. Is there a way how I can export only logs from the past day (or past week etc...) ?

Thanks for your help

asked 05 Dec '11, 05:40

simonattardGO's gravatar image

simonattardGO
915
accept rate: 0%


2 Answers:

I think it is not necessary to use export command. Can you use just search command and redirect the search result to the file? The search command will be like following in CLI. You can put it in your script and schedule it periodically.

/opt/splunk/bin/splunk search 'sourcetype=access_combined earliest=-7d@d' -maxout 0 > /tmp/test.csv

Hope this help.

link

answered 07 Dec '11, 23:58

Takajian's gravatar image

Takajian
7452315
accept rate: 18%

Do you know what the record/event limit is on that search via cmd line?

(12 Jan '12, 15:00) suhprano

You can use "-maxout 0" parameter. This means no limit number.

link

answered 12 Jan '12, 15:23

Takajian's gravatar image

Takajian
7452315
accept rate: 18%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×111
×6

Asked: 05 Dec '11, 05:40

Seen: 1,282 times

Last updated: 12 Jan '12, 15:23

Copyright © 2005-2012 Splunk Inc. All rights reserved.